Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot minimum and maximum boundaries for autoscaling

How can I limit the autoscaling of gnuplot, so that, as example for the y-max, it is at least a certain value and it would autoscale up to fixed "limit"?

From looking at the documentation, I only see how to fix min-, or max- end of the axis, while the other is being scaled automatically.

About autoscaling on PDF page 93

like image 311
varesa Avatar asked Jun 29 '12 22:06

varesa


3 Answers

Since version 4.6 gnuplot offers a new syntax to specify upper and lower limits for the autoscaling. For your case you could use

set xrange [0:100 < * < 1000]

Quoting from the documentation:

The range in which autoscaling is being performed may be limited by a lower bound <lb> or an upper bound <ub> or both. The syntax is

{ <lb> < } * { < <ub> }

For example

0 < * < 200

sets <lb> = 0 and <ub> = 200.

That syntax can be applied to both the minimum or maximum value of set *range.

To autoscale xmin but keeping it positive, use

set xrange [0<*:]

To autoscale x but keep minimum range of 10 to 50:

set xrange [*<10:50<*]

See the documentation about set xrange for more information.

like image 83
Christoph Avatar answered Oct 21 '22 00:10

Christoph


I don't think it is possible, either you have autoscaling on no-, min- or max-, or both axis i.e.:

set yrange [FIXED_MIN : FIXED_MAX]
set yrange [        * : FIXED_MAX]
set yrange [FIXED_MIN :         *]
set yrange [        * :          ]

Respectively.

like image 43
Thor Avatar answered Oct 21 '22 00:10

Thor


In this case, you could filter the data and let gnuplot do it's normal auto-scaling:

set yrange [*:*]
plot 'mydatafile' u 1:(($2 >= YMIN && $2 <= YMAX) ? $2 : 1/0)
like image 44
mgilson Avatar answered Oct 20 '22 22:10

mgilson