1

Given the following data file 'data.dat' composed of three data sets

-2.30368    2.44474
-2.22212    0.0250215
-2.13275    0.312357
-2.10241    0.13895


-2.63484    737.779
-2.44552    0.0156069
-2.1611 0.0360564
-1.98332    0.047829


-2.55816    1.91885
-2.45481    0.0410066
-2.27375    0.0593876
-1.95196    0.0220463

I want to plot all data sets on the same plot, by powering the second column to the index of the data set

pl 'data.dat' u ($1):(($2)**0) i 0, '' u ($1):(($2)**1) i 1, '' u ($1):(($2)**2) i 2

Is there a way to do this automatically for all indexes?

James
  • 383
  • 1
  • 4
  • 15

1 Answers1

1

Yes, i think it's possible using a loop structure. You can try, for instance, the command line

p for [k=0:MAX] 'data.dat' u ($1):($2**k) i k

where k is growing from 0 to your MAX number previously defined in gnuplot. If you want more about loop structure in plotting data with gnuplot you can take a look on this other question on Stack Overflow.

Community
  • 1
  • 1
opisthofulax
  • 517
  • 8
  • 25