On 14.04.2020 22:43, Darby wrote:
I've run into a problem with controlling the legend when using
multiplot. I want the legend to stay in 1 column on the right side
of the plot. With just a single plot per page, this works. But if I
use multiplot (4 plots per page, layout 2,2), the legend wants to
split into multiple columns, even if I try to force it to one column
with "maxcols 1". In this case, the legend is too wide and obscures
some of the plots. However, a multiple with two tall plots side by
side seems to do the right thing. So it seems like this is tied to
the size of the plot, not the page. I've recreated this with some
simple examples below. I'm using gnuplot 4.6 patchlevel 2 on CentOS
7.7.
In your example you generate a legend for every plot at the same place.
A legend can't be longer or higher than the plot itself.
You can specify the place of every key entry separately in the plot
command. Than you can place the key entry where ever you want.
I don't know if this works with gnuplot 4.6, I tested it with gnuplot 5.2
set xrange [-pi:pi]
set key at screen 1,1
set key maxcols 1
set multiplot layout 2,3 columnsfirst scale 1.0, 1.0
plot 10*sin(1*x) w l t 'sin' at 0.9,0.9,\
10*sin(2*x) w l t 'sin' at 0.9,0.86,\
10*sin(1*x) w l t 'sin' at 0.9,0.82,\
10*sin(2*x) w l t 'sin' at 0.9,0.78,\
10*sin(2*x) w l t 'sin' at 0.9,0.74,\
10*cos(1*x) w l t 'cos' at 0.9,0.70,\
10*cos(2*x) w l t 'cos' at 0.9,0.66,\
10*cos(1*x) w l t 'cos' at 0.9,0.62,\
10*cos(2*x) w l t 'cos' at 0.9,0.58,\
10*cos(2*x) w l t 'cos' at 0.9,0.54,\
1*x w l t 'line' at 0.9,0.50,\
2*x w l t 'line' at 0.9,0.46,\
3*x w l t 'line' at 0.9,0.42,\
4*x w l t 'line' at 0.9,0.38,\
5*x w l t 'line' at 0.9,0.34,\
-1*x w l t 'line' at 0.9,0.30,\
-2*x w l t 'line' at 0.9,0.26,\
-3*x w l t 'line' at 0.9,0.22,\
-4*x w l t 'line' at 0.9,0.18,\
-5*x w l t 'line' at 0.9,0.14
unset key
replot
replot
replot
unset multiplot
Jörg
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)