Question

I have a file with table to plot, every column in file correspond to one curve

for example, file1

N plot1 plot2 plot3

1 2     3     4
2 3     4     5

I run the gnuplot as following

gnuplot -e "set key autotitle columnhead; set title 'file1'; plot 'file1' using 1:2 with lines, 'file1' using 1:3 with lines, 'file1' using 1:4 with lines"

The problem is if I have a lot of curves to plot, I have a lot of columns I need to describe them in command for gnuplot, however I think it's pretty standard to plot every column file with the first column, like 1:2 1:3 1:4

Can I do it in more convenient way, without listing all columns?

Was it helpful?

Solution

This can be done using a forloop, e.g.

plot for [i=2:4] "file" using 1:i

You need a version of Gnuplot of at least 4.4 for this feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top