How do gnuplot margins work in multiplot mode?

女生的网名这么多〃 提交于 2019-12-19 05:52:06

问题


I am a bit confused about gnuplot margins. First of all I have no idea what units these things are pointing to. Are they pointing to the canvas coordinates OR are they a fraction of the canvas coordinates. Do they behave the same in gnuplot mode and multiplot mode?

My problem arises when plotting some data in multiplot mode. I am plotting to the screen (wtx terminal). Let's just say I am bungling things badly - I get plots off the canvas, or very small unreadable plots.

Without margins the first plot is flush against the top of the canvas, so naturally I want to push it down a bit.

Can someone explain how gnuplot margins work and if they behave the same in multiplot mode.


回答1:


Yes, the margins behave very similar in "normal" plotting mode and in multiplot mode. Basically, the margins can have three different "modes":

  1. Automatic, which is the default.
  2. Setting each margin to a specific size, like set lmargin 2. The unit is character widths (or character heights for tmargin and bmargin).
  3. Setting a specific position of a border relative to the whole canvas, like set lmargin at screen 0.1, which sets the left plot border at 10% of the total canvas width.

The only difference of the multiplot mode is, that the reference for the margins in 1. and 2. is given by the sites determined by the layout option:

set multiplot layout 2,2

This subdivides the whole canvas in four rectangles of equal size. Now, using

set lmargin 1
set rmargin 1
set tmargin 1
set bmargin 1

leaves a margin of one character width or height on each side of each subplot with respect to the smaller rectangles:

set multiplot layout 2,2
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0
set format ''
plot x
plot x**2
plot x**3
plot x**4
unset multiplot

set multiplot layout 2,2
set lmargin 1
set rmargin 1
set tmargin 1
set bmargin 1
set format ''
plot x
plot x**2
plot x**3
plot x**4
unset multiplot

If you want to set absolute positions of each border, this becomes more cumbersome, because you have to set four margins for each plot (the layout options doesn't have any effect in this case):

set multiplot
set lmargin at screen 0.1
set rmargin at screen 0.47
set tmargin at screen 0.97
set bmargin at screen 0.6
plot x
...

Gnuplot version 5 offers a quite flexible way to produce equal rectangles, see my answer to Removing blank gap in gnuplot multiplot



来源:https://stackoverflow.com/questions/29376374/how-do-gnuplot-margins-work-in-multiplot-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!