Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

multiplot layout and changing size of canvas in EPS term

2,382 views
Skip to first unread message

Nicholas Musolino

unread,
Jan 5, 2012, 8:26:49 PM1/5/12
to
I am a fairly advanced gnuplot user who would like to create a
multiplot figure using the layout option that includes 2 graphs, one
over the other.

What I want is for both graphs to have the approximate size of the
"normal" non-multiplot graph. For example, I normally use "set size
0.8,0.8" for single-graph (non-multiplot) figures. What I would like
is to have two graphs of this approximate size, with a total canvas
size of 0.8,1.6 times an ordinary canvas. I

n fact, I think this should be the default behavior, rather than
compressing Nx1 figures into the original canvas; for example, see the
first figure showcased at http://gnuplot.sourceforge.net/demo/layout.html,
which isn't too impressive.

In older versions of GNUPLOT (3.8, 4.0), I would set origin, margin,
and graph size individually to make this all line up, using a BASH
script to create a gnuplot script. I had thought that this ugly
process would be over with gnuplot 4.4.

Now, when I use multiplot layout after changing the canvas size in
gnuplot 4.4 patchlevel 3, the graphs do not expand to full canvas
size; rather, they remain their original "half-height" size, and only
take up half the canvas.

To help illustrate this, I made an album of the pdf files (after
applying epstopdf) at http://imgur.com/a/zoKDV/all#0. Sorry for the
site's conversion to low-res PNG files. The first image in the album
is the "target"; I want to have two very similar (size and shape)
graphs stacked two-by-one. The second two images illustrate what
gnuplot produces with postscript term.

Script follows; sorry for the leading whitespace; that's from a bash
script.

Thanks in advance for any help/advice people can offer!

set term postscript eps enhanced
color
set size
1,2
set multiplot layout 2,1 columnsfirst title "GEN $gen
CAND ${id}; {/Symbol f}_c = $phicut
deg"

set style line 1 lt 1 lw 3 lc rgb
"red"
set style line 2 lt 3 lw 3 lc rgb
"black"

set key
box;

frandom(x) =
sin(x);

set ylabel "probability
density"

set xtics format "%.
2f"
set xrange [0.0:pi/
2]
set mxtics
4

# plot
1
set ytics format "%.
1f"
set yrange [0.0:]
writeback
set mytics
5

plot "${thetahistfile[E2]}" using 1:(\$4) with histeps
ls 1 title "observed distr., E2 sim.",
\
frandom(x) with lines
ls 2 title "random distr."

# plot
2
#set origin
0,0.5
set key
box;
set xlabel "aryl normal/aryl normal angle
(rad)"
set ylabel "probability
density"

set xtics format "%.
2f"
set xrange [0.0:pi/
2]
set mxtics
4


set ytics format "%.
1f"
set yrange
restore
set mytics
5

plot "${thetahistfile[E6]}" using 1:(\$4) with histeps
ls 1 title "observed distr., E6 sim.",
\
frandom(x) with lines
ls 2 title "random distr."

unset
multiplot

sfeam

unread,
Jan 5, 2012, 10:39:46 PM1/5/12
to
There is probably the heart of the problem.
For better or worse, starting in gnuplot version 4.2 the "set size"
command cannot be used to enlarge the total output size from a terminal.

In a nutshell, to change the size of the output from a terminal,
append the desired "size" attribute to the terminal selection itself.

If I understand your requirement correctly, you want:

set term postscript eps enhanced color size 4in, 5.6in
set multiplot layout 2,1

That gives you a total output size equal to 80% of two default size
plots (5in x 3.5in) stacked on top of each other, and tells multiplot
that in fact you do want two plots stacked on top of each other.
You do not want to further compress the plot size within this space,
so no "set size" command.

Nicholas Musolino

unread,
Jan 6, 2012, 5:57:49 AM1/6/12
to
Thank you very much for your quick reply. I will try this and report
back to the group.

I did check the options used using "set term postscript" in
interactive mode, but size wasn't listed.

Thanks again.

Nicholas Musolino

unread,
Jan 9, 2012, 2:32:49 PM1/9/12
to
This solution did essentially solve the problem. Thank you very much
for your help, sfeam.

Nicholas Musolino
0 new messages