Preventing tic labels from resizing graph in gnupl

2019-03-06 04:11发布

问题:

I'm trying to make a general plot where I don't know the range. Sometimes there will be more zero's or a "-" on the tic marks, which causes the graph area to contract. I would prefer the tic labels just extend farther to the left preserving the graph size. This helps with alignment which is a crucial part of these plots.

Does anyone have an idea about how to do this? My searches haven't revealed anything yet.

回答1:

You can use set lmargin to set a fixed left margin. With e.g. set lmargin 10 you fix the left margin to 10 character widths:

set multiplot layout 2,1
set lmargin 10    
set xrange [0:10]
plot x

set xrange[0:100000]
plot x
unset multiplot

Of course, you must still find an appropriate setting for the left margin size.

As another point, also the label position depends on the ticlabel length.

set multiplot layout 2,1
set lmargin 10
set ylabel 'ylabel'

set xrange [0:10]
plot x

set xrange[0:100000]
plot x
unset multiplot

So you would need to change the ylabel position with the offset parameter. To have it more general, you can put the ylabel with a usual set label command to have it fixed independent of the margin settings:

set multiplot layout 2,1
set lmargin 10
set label 1 'manual label' at screen 0.03,graph 0.5 center rotate by 90

set xrange [0:10]
plot x

set xrange[0:100000]
plot x
unset multiplot