solalito
solalito

Reputation: 1209

Plot multiple functions from a data file in gnuplot

I want to plot several functions on the same plot on gnuplot using file data. One way of doing this is:

set multiplot
plot 'data.dat' using 1:2
plot 'data.dat' using 1:3
...

I want to know if there is a quicker way to do it. I have to plot around 10 functions on the same plot and that can get slow. Something like that would be ideal:

plot 'data.dat' using 1:2, using 1:3, using 1:4, ... using 1:n with lines

Upvotes: 0

Views: 9199

Answers (1)

Christoph
Christoph

Reputation: 48390

That's almost correct, just use

set style data lines
plot 'data.dat' using 1:2, '' using 1:3, '' using 1:4

This doesn't require multiplot mode.

With version 4.6 you can also iterate over the columns:

plot for [i=2:4] 'data.dat' using 1:i

Upvotes: 2

Related Questions