I am attempting to generate a plot with a large top margin, and in that margin space place a large key.
According to the Gnuplot 5.2 Documentation:
set tmargin {{at screen} <margin>}
The margin is the distance between the plot border and the outer edge of the canvas
and
... screen specifies the screen area (the entire area - not just the portion selected by set size), with 0,0 at the bottom left and 1,1 at the top right.
However, when I run the following script,
reset
set terminal pngcairo font '12,'
set key on tmargin
N = 15
M = 20
do for [m=2:(M-2)] {
this_margin = m/(0.0 + M)
#print this_margin
set tmargin at screen this_margin
set title sprintf("set tmargin at screen %0.2f",this_margin)
set output sprintf("margin_test_%02i.png", m)
plot for [i=0:N] cos(i*x) title sprintf("cos(%2ix)",i)
}
I generate the following animation:
This animation shows that when the margin is large (i.e. set margin at screen 0.15
), the key fails to fill the margin, instead it is squished into the top margin space. Only when the margin is small (i.e. set margin at screen 0.80
) is the key allowed to drop down to a single column. Isn't this behavior backwards?
How do I get a large top margin (i.e. set tmargin at screen 0.20
like the beginning plot in the animation) without having gnuplot squish a tmargin key up into the top of the canvas?
Note that simply setting the key location manually (e.g. set key at x,y maxcols 1
) does not fix the squashed key for large margins.