Menu

#367 Automatic properties (x/ylabel, key) for multiplot

None
closed-out-of-date
nobody
None
5
2018-10-11
2013-06-29
No

Currently in gnuplot, one has to resort to some mild trickery (a la the last demo on this page: http://gnuplot.sourceforge.net/demo_4.6/layout.html) to get things such as xlabel, ylabel or the key for a multiplot, especially if you are picky about getting the plots the same size. It would be nice to be able to specify these in the same way as for regular plots, e.g.

set multiplot layout 4,1 title 'My many plots'
set multiplot xlabel 'Overall xlabel'
set multiplot key

In this setup, the multiplot [key|xlabel|ylabel] commands would automatically adjust the margins/size of the multiplot as the regular commands do for regular plots. The key could accumulate labels from all the other plots, possibly with an option to not include duplicates.

I understand that this may be tricky to implement for a number of reasons, but it is my and my colleagues' main frustration with multiplot.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2013-06-29

    We already have "set multiplot title"

    Could you explain what the effect of "set multiplot xlabel" would be? Setting xlabel is already persistent and affects all plots in the multiplot. What would this do differently?

     
  • Andrew Rasmussen

    set multiplot xlabel (for the example of a multiplot layout column of several plots with a shared time axis) would set an xlabel below the bottom plot only, and adjust the vertical sizes of the plots to accommodate the label. Similarly, multiplot ylabel would adjust the x dimension of a row of plots to fit a ylabel on the left/rightmost plot.

    Currently the strategy to do this is something like

    1
    2
    3
    4
    5
    #!/usr/bin/env gnuplot
    set multiplot layout 2,1
    plot x
    set xlabel 'foo'
    plot x
    

    to get the xlabel on only the bottom plot. The problem with this is that now the plots are different sizes--only the bottom one has shrunk to accommodate the label.

    The multiplot xlabel/key options may only make sense as an option for multiplot layout, since otherwise the user is probably going to have to set margins, etc. manually anyway, and gnuplot would not be informed of the dimensions of each plot beforehand.

    It is common enough practice to produce a column/row of plots with a single axis label for all the plots that I think this would be a very useful option to have.

    Here is an example where this would be useful.

    Here is another.

     
  • Christoph Bersch

    Andrew,

    a plot like the second example you gave was my motivation to write the patch http://sourceforge.net/p/gnuplot/patches/611/. I don't know if this would fit your needs.
    It allows one to specify fixed margins and fixed spacing between all plots in a multiplot.

    Christoph

     
  • Ethan Merritt

    Ethan Merritt - 2018-10-11
    • status: open --> closed-out-of-date
    • Group: -->
     

Log in to post a comment.