Gnuplot multiplot with one colorbox

2020-07-30 05:16发布

问题:

I have a layout of 3,1 plots using multiplot. All of the three plots have the same scales, so I just want to show one colorbox, on the right margin. However, once I unset the colorbox for the first two plot, the size of the three plot are different. Can anybody tell me how to implement this with the three plots have the same size?

回答1:

You must set a fixed right margin with e.g. set rmargin at screen 0.85. That sets the right border of the plot at 85% of the image size:

set multiplot layout 3,1

set rmargin at screen 0.85
plot x 
plot x
plot x linecolor palette
unset multiplot
set output

Output with 4.6.3:

See also the related question multiplot - stacking 3 graphs on a larger canvas.

Generic solution for fixed margins

If you want a layout with one row and three columns, can use the multiplot options margins and spacing to get three plots which have the same width:

set xlabel 'xlabel'
set ylabel 'ylabel'

set multiplot layout 1,3 margins 0.1,0.9,0.1,0.95 spacing 0.05

plot x

unset ylabel
plot x

plot x linecolor palette

unset multiplot