1

This question is related to this one: store commented value from data file in gnuplot

I formatted now every single data file that it looks like:

    1.0  0.01

    0.2  0.0163  0.0000125
    0.4  0.0275  0.0001256

Then I tried to read the first line and store it into variables in this way:

set term push
set term unknown    
plot dataFile every ::0::0 using (a=$0):(b=$1)
set term pop

But this is not working as it should, why? The rest of the file I plot as follows:

plot dataFile every ::1 using 1:2:3 with errorbars lt 1 linecolor "red",f(a,b)

1 Answer 1

0

Column counting starts at 1, the zeroth column is the row number. And you must also restrict to the first block (note the three colons). Try

plot dataFile every :::0::0 using (a=$1):(b=$2)

Alternatively you can use stats in a similar way:

stats dataFile every :::0::0 using 1:2
a = STATS_min_x
b = STATS_min_y
2
  • Thank you! it works now. but it gives me some warnings like empty x range [0:0], adjusting to [-1:1] or empty y range [2:2], adjusting to [1.98:2.02]. it does not seem like the influence the plot, but where do they come from? or what has to be fixed?
    – nerdizzle
    Mar 12, 2015 at 0:07
  • You can ignore that, it is a normal warning when plotting a single point.
    – Christoph
    Mar 12, 2015 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.