pUTa432
pUTa432

Reputation: 57

Plotting one-many function in gnuplot

I have a data file that looks like:

    a               b                     c                   d
9.91804289    0.32890611E-04        2.253113185e-08    2.858389795e-08
9.91804289    0.32890611E-04        2.253113185e-08    2.858389795e-08
9.89517766    0.32597535E-04        2.255018344e-08    2.742542369e-08
9.86882582    0.33125571E-04        2.251589285e-08    2.650318558e-08

Now, all b,c and d are functions of a. However, b varies a lot as a function of a (and attains the same value at various different a). I need to plot c and d as a function of b. But due to this variation of b (basically its one-many nature), I have unwanted branches in the c and d plots. Is there any way in gnuplot where I can plot it the way I want by setting the xrange using a only?

Upvotes: 0

Views: 89

Answers (1)

user8153
user8153

Reputation: 4095

Take a look help using for how to filter your input data. If you want to select only those rows in your datafile where the value of the first column is between amin and amax, you could do something like

amin=9.8
amax=9.9
plot "filename.dat" using 2:(($1 > amin && $1 < amax ) ? $3 : NaN) title "c" with points, \
     "" using 2:(($1 > amin && $1 < amax ) ? $4 : NaN) title "d" with points

Upvotes: 2

Related Questions