0
votes

I'm plotting six differents graphs in a multiplot. I would like to autoscale axis. Values that are plotted are readed from txt files that are different in each execution, so I can't fix any value in xrange and yrange. That's why I need to autoscaling axis.

The problem is that multiplot doesn't allow to change term, so I can't plot in a dummy terminal and I don't know GPVAL_Y_MIN and GPVAL_Y_MAX values.

Any ideas? If graphs in multiplot don't have correct scale it is not very useful to display my data.

1

1 Answers

0
votes

You can use

set autoscale yfix

to have an autoscaled y-range but without extending it to the next tics. This would give you different ranges for each subplot.

If you need one yrange for all subplots, you can use the stats command (requires version 4.6). Using GPVAL_Y_* after plotting to a dummy terminal was the way to go for gnuplot versions prior to 4.6 (more a workaround).

Then you can iterate over all files to determine the common yrange:

filelist="A.txt B.txt C.txt D.txt E.txt F.txt"
i = 0
do for [f in filelist] {
    stats f using 1:2 nooutput
    if (i == 0) { 
        min_y = STATS_min_y
        max_y = STATS_max_y
        i = 1
    } else {
        min_y = (STATS_min_y < min_y ? STATS_min_y : min_y)
        max_y = (STATS_max_y > max_y ? STATS_max_y : max_y)
    }
}
set yrange [min_y:max_y]
set multiplot 
...