2

Initial situation:

I have a text file with six space separated columns [ x, F_{1}(x), ... ,F_{5}(x) ]

I'm plotting the graphs F_{1} to F_{5} into a single .png graphic using pngcairo:

set terminal pngcairo dashed size 1920,1080
set title "Title"
set output 'test.png'
set autoscale
plot 'test.txt' using 1:2 title "F_{1}" with lines, '' using 1:3 title "F_{2}" with     lines, '' using 1:4 title "F_{3}" with lines, '' using 1:5 title "F_{4}" with lines, '' using 1:6 title "F_{5}" with lines

F_{4}(x) unfortunately runs out of scale very quickly so I need to ignore that single column for autoscaling.

How can I ignore a single column for autoscaling?

I'm thinking of a command like "set autoscale not using 5".

Note: I do not want logscale in this case.

kaya3
  • 47,440
  • 4
  • 68
  • 97
norritt
  • 345
  • 4
  • 16
  • See also: http://stackoverflow.com/questions/11269877/gnuplot-minimum-and-maximum-boundaries-for-autoscaling – John_West Dec 14 '14 at 20:32

2 Answers2

4

The one solution is to exclude this column from the plot, save autoscale x- and y-range to variables, set this ranges as user-defined and replot (replot command works bad with pngcairo for me, so simply setting output to original file and rewriting it):

set terminal pngcairo dashed size 1920,1080
set title "Title"
set output 'test.png'
set autoscale
plot 'test.txt' using 1:2 title "F_{1}" with lines, '' using 1:3 title "F_{2}" with lines, '' using 1:4 title "F_{3}" with lines, '' using 1:6 title "F_{5}" with lines
MAXY=GPVAL_Y_MAX
MINY=GPVAL_Y_MIN
MAXX=GPVAL_X_MAX
MINX=GPVAL_X_MIN
unset autoscale
set yrange [MINY:MAXY]
set xrange [MINX:MAXX]
set output 'test.png'
plot 'test.txt' using 1:2 title "F_{1}" with lines, '' using 1:3 title "F_{2}" with lines, '' using 1:4 title "F_{3}" with lines, '' using 1:5 title "F_{4}" with lines, '' using 1:6 title "F_{5}" with lines
John_West
  • 2,239
  • 4
  • 24
  • 44
  • Hey John, thanks for the quick reply your solution works perfectly, you just have a little copy&past bug when saving MINX, MAXX (you assign the Y values again here) resulting in a broken plot. Could you fix that, so I can mark your answer as correct. Thanks! – norritt Dec 14 '14 at 22:23
0

Just as an update and for the records, apparently from gnuplot 5.0.3 on you have the option to set noautoscale in a plot command in order to exclude it for autoscaling. In the example below in the second plot, the 4th function exp(x) is excluded for autoscaling.

Code:

### exclude data for autoscaling (gnuplot>=5.0.3)
reset session

# create some test data
set table $Data
    f1(x) = x
    f2(x) = x**2
    f3(x) = 0.2*x**3
    f4(x) = exp(x)
    f5(x) = 50*sin(x)
    plot '+' u (x):(f1(x)):(f2(x)):(f3(x)):(f4(x)):(f5(x)) w table
unset table

set multiplot layout 2,1
    plot for [i=1:5] $Data u 1:i+1 w l ti sprintf("f%d",i)

    plot for [i=1:3] $Data u 1:i+1 w l ti sprintf("f%d",i), \
         for [i=4:4] $Data u 1:i+1 w l ti sprintf("f%d",i) noautoscale, \
         for [i=5:5] $Data u 1:i+1 w l ti sprintf("f%d",i)
unset multiplot
### end of code

Result:

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72