1

Is there any way to set automaticaly xrange in gnuplot base on how many lines have my datafile ? I tried autoscale but it still let me few centimeters of free space at the end of my plot. I mean something like

set xrange ["0":"EOF"]

datafile sample:

0|18:33:56|5.6094713|-2.5295162|0.05702305
1|18:33:56|5.506433|-1.9757175|0.25703526
2|18:33:56|5.7228355|-1.7813735|0.59802055
3|18:33:56|5.8039265|-1.6758609|0.97007275
4|18:33:56|5.675423|-1.581326|1.2965202
5|18:33:56|5.3796544|-1.4743104|1.4236889

Can I put some mark at the end of datafile and set it in gnuplot or ?

2 Answers 2

5

To have a tightly fitted xrange, use

set autoscale xfix
Sign up to request clarification or add additional context in comments.

1 Comment

Tnaks this is what i needed ;)
4

If your gnuplot's version is 4.6 or later, you can use stats command

stats 'datafile' using 1
set xrange [0:STATS_records]

You can also use other statistical variables such as STATS_min, STATS_max. For more information, type help stats in your gnuplot's prompt.

1 Comment

I think it should work as I tested with my data. You can check it by print STATS_records or print STATS_min in gnuplot's prompt after the stats command. Of course the answer of @Christoph is much better.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.