Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4323

Re: Legend behavior would multiplot

From Jörg Buchholz <bookwood4new@freenet.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Legend behavior would multiplot
Date 2020-04-16 13:22 +0200
Organization A noiseless patient Spider
Message-ID <r79f6g$7s6$1@dont-email.me> (permalink)
References <3095ba79-70e8-4f1d-9c1f-c2f2b7561b3f@googlegroups.com>

Show all headers | View raw


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

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Legend behavior would multiplot Darby <darby.vicker@gmail.com> - 2020-04-14 13:43 -0700
  Re: Legend behavior with multiplot Darby <darby.vicker@gmail.com> - 2020-04-14 13:47 -0700
  Re: Legend behavior would multiplot Jörg Buchholz <bookwood4new@freenet.de> - 2020-04-16 13:22 +0200
  Re: Legend behavior would multiplot Jörg Buchholz <bookwood4new@freenet.de> - 2020-04-20 14:31 +0200

csiph-web