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


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

Legend behavior would multiplot

Newsgroups comp.graphics.apps.gnuplot
Date 2020-04-14 13:43 -0700
Message-ID <3095ba79-70e8-4f1d-9c1f-c2f2b7561b3f@googlegroups.com> (permalink)
Subject Legend behavior would multiplot
From Darby <darby.vicker@gmail.com>

Show all headers | View raw


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.  






set xrange [-pi:pi]
set key at screen 1,1

# ----------

# The legend for a single plot seems to respect the space of the plot
# and only uses 1 column.

set size 0.9,1.0
plot for [i=1:5] 10*sin(i*x) w l t 'sin',\
     for [i=1:5] 10*cos(i*x) w l t 'cos',\
     for [i=1:5]     i*x     w l t 'line',\
     for [i=1:5]    -i*x     w l t 'line'
pause -1

# ----------

# The legend for a multiplot seems NOT to respect the space of the plots
# and uses 2 columns, despite the explicit request for one column.

set key maxcols 1
set multiplot layout 2,2 scale 0.8, 1.0

   replot
   replot
   replot
   replot

unset multiplot

pause -1

# ----------

# But a "layout 1,2" multiplot will do one column.  Is it based on the height of the 
# plot?  

set multiplot layout 1,2 scale 0.8, 1.0

   replot
   replot

unset multiplot

pause -1
# ----------

Back to comp.graphics.apps.gnuplot | Previous | NextNext 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