How to adjust xrange to min and max of the points actually plotted in gnuplot?

Viewed 82

Normally the xrange and yrange are adjusted to fit the largest and smallest value in the datafile, when plotting according to

plot "my_file.dat" u 1:2

Suppose I want to apply a cutoff to the y-values, so that I only include the points whose y-value is larger than, say 1. If I do

plot "my_file.dat" u 1:($2>1?$2:NaN)

I indeed select only those points. The problem, however, is that the xrange is still adjusted to the range of column 1 of the entire datafile, rather than to only those points which are actually plotted. How can I fix this? My gnuplot version is 5.2.

1 Answers
Related