0
votes

I'm plotting a multiplot in GNUPLOT and in order to save space, I only plot the axis labels on one of the plots. For the other plots, I overwrite the tics-labels using

set ytics ("" -20, "" -15, "" -10, "" -5, "" 0, "" 5, "" 10, "" 15, "" 20)

For a small scale like this, its doable manually. Can I use a gnuplot built-in (for-loop) to dynamically write this "range"?

2

2 Answers

3
votes

Yes, you can, with something like

numtics = 8

set macros

ticstring = '('

do for [i=0:numtics] {
    ticstring = ticstring.'"" '.(-20 + i*5).', '
}

ticstring = ticstring.'"" 20)'

set ytics @ticstring

What may be simpler in your case would be the command

set ytics format "" 5

Which will put a tic every 5 with a blank label.

2
votes

I think that it is MUCH easier to just do something like:

set multiplot layout 1,2

set xtics format ""   #no x-tic labels on the top plot
plot sin(x)           #top plot

set xtics format "%g" #x-tic labels on the bottom plot
plot cos(x)           #bottom plot

unset multiplot