Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1729 > unrolled thread

Multiplot question

Started byDieter Britz <dieterhansbritz@gmail.com>
First post2013-03-26 09:30 +0000
Last post2013-03-26 15:57 +0100
Articles 8 — 5 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Multiplot question Dieter Britz <dieterhansbritz@gmail.com> - 2013-03-26 09:30 +0000
    Re: Multiplot question Karl <mail.kfr@gmx.net> - 2013-03-26 14:21 +0100
      Re: Multiplot question Dieter Britz <dieterhansbritz@gmail.com> - 2013-03-26 13:35 +0000
    Re: Multiplot question Ingo Thies <ingo.thies@gmx.de> - 2013-03-26 15:57 +0100
      Re: Multiplot question Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-04 09:01 +0000
        Re: Multiplot question sfeam <sfeam@users.sourceforge.net> - 2013-04-04 12:08 -0700
          Re: Multiplot question Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-05 08:44 +0000
    Re: Multiplot question Christoph Bersch <usenet@bersch.net> - 2013-03-26 15:57 +0100

#1729 — Multiplot question

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-03-26 09:30 +0000
SubjectMultiplot question
Message-ID<kirps0$4b7$1@dont-email.me>
I have the following multiplot (stripped of
labelling etc)

set size square
set multiplot layout 1, 2
plot 'vb.dat' w l lt 1, 'vbp.dat' w p pt 7 ps 1
plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1 

This produces two plots, both square, side by side,
and the same size.

However, I would like the right-hand one stretched
in the x-direction by a factor, but to keep its
vertical height.

How do I do that please?

-- 
Dieter Britz

[toc] | [next] | [standalone]


#1731

FromKarl <mail.kfr@gmx.net>
Date2013-03-26 14:21 +0100
Message-ID<kis7d9$h3p$1@news.rz.uni-karlsruhe.de>
In reply to#1729
Am 26.03.2013 10:30, schrieb Dieter Britz:
> I have the following multiplot (stripped of
> labelling etc)
> 
> set size square
> set multiplot layout 1, 2
> plot 'vb.dat' w l lt 1, 'vbp.dat' w p pt 7 ps 1
> plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1 
> 
> This produces two plots, both square, side by side,
> and the same size.
> 
> However, I would like the right-hand one stretched
> in the x-direction by a factor, but to keep its
> vertical height.
> 
> How do I do that please?
> 
gp> help multiplot

...(ganz unten)...

The commands _set origin_ and _set size_ must be used to correctly
position each plot if no layout is specified or if fine tuning is desired.

The vertical position of the plots (the abscissas) might need some fine
tuning, as the space needed for the numbering could change.

  Karl

[toc] | [prev] | [next] | [standalone]


#1732

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-03-26 13:35 +0000
Message-ID<kis86c$equ$1@dont-email.me>
In reply to#1731
On Tue, 26 Mar 2013 14:21:45 +0100, Karl wrote:

> Am 26.03.2013 10:30, schrieb Dieter Britz:
>> I have the following multiplot (stripped of labelling etc)
>> 
>> set size square set multiplot layout 1, 2 plot 'vb.dat' w l lt 1,
>> 'vbp.dat' w p pt 7 ps 1 plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1
>> 
>> This produces two plots, both square, side by side,
>> and the same size.
>> 
>> However, I would like the right-hand one stretched in the x-direction
>> by a factor, but to keep its vertical height.
>> 
>> How do I do that please?
>> 
> gp> help multiplot
> 
> ...(ganz unten)...
> 
> The commands _set origin_ and _set size_ must be used to correctly
> position each plot if no layout is specified or if fine tuning is
> desired.

That seems to me to adjust the size of each entire plot. I want
the right-hand plot to be stretched in the x-direction only.
The reason is that it has a quarter-circle in it, and I want that
to be circular to the eye. The x- and y-ranges are different.

-- 
Dieter Britz

[toc] | [prev] | [next] | [standalone]


#1733

FromIngo Thies <ingo.thies@gmx.de>
Date2013-03-26 15:57 +0100
Message-ID<ardr9rF4ocjU1@mid.individual.net>
In reply to#1729
Am 26.03.2013 10:30, schrieb Dieter Britz:
> I have the following multiplot (stripped of
> labelling etc)
>
> set size square
> set multiplot layout 1, 2
> plot 'vb.dat' w l lt 1, 'vbp.dat' w p pt 7 ps 1
> plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1
>
> This produces two plots, both square, side by side,
> and the same size.
>
> However, I would like the right-hand one stretched
> in the x-direction by a factor, but to keep its
> vertical height.
>
> How do I do that please?
>

You get the highest degree of freedom by setting the margins in screen 
coordinates

set lmargin screen num1
set rmargin screen num2
set bmargin screen num3
set tmargin screen num4

where num1...num4 are numbers between 0 and 1 marking the *absolute* 
positions of the graph borders (*not* the margin width in this case). 
This requires a little bit of math to get the dimensions correct, since 
the shape of each plots depends on both the margin coordinates and the 
canvas (screen) dimensions.

Example: let the aspect x:y ratio of the plotting canvas be 9:4, e.g. 
1125x500 (these pixel numbers give convenient round values in this 
example). Then the following settings will give a square graph left and 
a 6:5 graph

set multiplot

set lmargin screen 0.05 # first plot spans 0.4*1125 = 450 pixels
set rmargin screen 0.45 # in width
set bmargin screen 0.05 # and 0.9*500 = 450 pixels
set tmargin screen 0.95 # in height, => square

plot 'vb.dat' w l lt 1, 'vbp.dat' w p pt 7 ps 1

set lmargin screen 0.50 # width now 0.48*1125 = 540 pixels
set rmargin screen 0.98 # in width
set bmargin screen 0.05 # but the same pixel numer
set tmargin screen 0.95 # in height

plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1

Since you can use variables for the numbers, you can define the relevant 
math in your plotting script to scale it arbitrarily. I have done a 
similar thing for regular plotting panels, but this won't be of much 
help in your case.

HTH

Best wishes,

Ingo

[toc] | [prev] | [next] | [standalone]


#1738

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-04 09:01 +0000
Message-ID<kjjfgi$8dh$1@dont-email.me>
In reply to#1733
On Tue, 26 Mar 2013 15:57:01 +0100, Ingo Thies wrote:

> Am 26.03.2013 10:30, schrieb Dieter Britz:
>> I have the following multiplot (stripped of labelling etc)
>>
>> set size square set multiplot layout 1, 2 plot 'vb.dat' w l lt 1,
>> 'vbp.dat' w p pt 7 ps 1 plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1
>>
>> This produces two plots, both square, side by side,
>> and the same size.
>>
>> However, I would like the right-hand one stretched in the x-direction
>> by a factor, but to keep its vertical height.
>>
>> How do I do that please?
>>
>>
> You get the highest degree of freedom by setting the margins in screen
> coordinates
[...]

I tried to follow your example but no luck. I have made up
a mini-example. Two data files, left.dat:

0.0 0.0
0.0 1.0
1.0 1.0
1.0 0.0
0.0 0.0

and an identical file right.dat (OK, I could have used just
the one), and this script:

gnuplot << eoi
set term postscript enh eps 20
set output 'leftright.eps'
unset key
set size square             # ??
set multiplot layout 1, 2
set lmargin screen 0.05
set rmargin screen 0.45
set bmargin screen 0.05
set tmargin screen 0.95
plot 'left.dat' w l lt 1
set lmargin screen 0.55
set rmargin screen 0.95
set bmargin screen 0.05
set tmargin screen 0.95
plot 'right.dat' w l lt 1
quit
eoi

This produces two squares, side by side, with extra
unwanted space at the top (?). The "set size square"
statement makes both plots square. If I leave it out, I get
two identical tall rectangles but I want the the left-hand
one square.

So how do I modify the script to make the square on the right
a rectangle, stretched by a factor, say 1.33, in the x-direction?

-- 
Dieter Britz

[toc] | [prev] | [next] | [standalone]


#1742

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-04-04 12:08 -0700
Message-ID<kjkiv9$6fp$1@dont-email.me>
In reply to#1738
Dieter Britz wrote:

> On Tue, 26 Mar 2013 15:57:01 +0100, Ingo Thies wrote:
> 
>> Am 26.03.2013 10:30, schrieb Dieter Britz:
>>> I have the following multiplot (stripped of labelling etc)
>>>
>>> set size square set multiplot layout 1, 2 plot 'vb.dat' w l lt 1,
>>> 'vbp.dat' w p pt 7 ps 1 plot 'rz.dat' w l lt 1, 'rzp.dat' w p pt 7 ps 1
>>>
>>> This produces two plots, both square, side by side,
>>> and the same size.
>>>
>>> However, I would like the right-hand one stretched in the x-direction
>>> by a factor, but to keep its vertical height.
>>>
>>> How do I do that please?
>>>
>>>
>> You get the highest degree of freedom by setting the margins in screen
>> coordinates
> [...]
> 
> I tried to follow your example but no luck. I have made up
> a mini-example. Two data files, left.dat:
> 
> 0.0 0.0
> 0.0 1.0
> 1.0 1.0
> 1.0 0.0
> 0.0 0.0
> 
> and an identical file right.dat (OK, I could have used just
> the one), and this script:
> 
> gnuplot << eoi
> set term postscript enh eps 20
> set output 'leftright.eps'
> unset key
> set size square             # ??
> set multiplot layout 1, 2
> set lmargin screen 0.05
> set rmargin screen 0.45
> set bmargin screen 0.05
> set tmargin screen 0.95
> plot 'left.dat' w l lt 1
> set lmargin screen 0.55
> set rmargin screen 0.95
> set bmargin screen 0.05
> set tmargin screen 0.95
> plot 'right.dat' w l lt 1
> quit
> eoi
> 
> This produces two squares, side by side, with extra
> unwanted space at the top (?). The "set size square"
> statement makes both plots square. If I leave it out, I get
> two identical tall rectangles but I want the the left-hand
> one square.
> 
> So how do I modify the script to make the square on the right
> a rectangle, stretched by a factor, say 1.33, in the x-direction?

The "layout" option in multiplot is for the specific purpose of
blocking out equal size fractions of the canvas, which is apparently
not what you want.  How about

set multiplot
set size ratio 1.0
set lmargin at screen 0.05
set bmargin at screen 0.05
set rmargin at screen 0.40
set tmargin at screen 0.40
plot 'left.dat'
set size ratio 1.0/1.33
set rmargin at screen 0.95
set lmargin at screen 0.95 - 1.33*(0.35)
set bmargin at screen 0.05
set tmargin at screen 0.40
plot 'left.dat'
unset multiplot

There may well be simpler ways, but I'm not clear on exactly
what arrangement you want.

	Ethan


[toc] | [prev] | [next] | [standalone]


#1744

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-05 08:44 +0000
Message-ID<kjm2tn$1e3$1@dont-email.me>
In reply to#1742
On Thu, 04 Apr 2013 12:08:40 -0700, sfeam wrote:
[...]
> The "layout" option in multiplot is for the specific purpose of blocking
> out equal size fractions of the canvas, which is apparently not what you
> want.  How about
> 
> set multiplot set size ratio 1.0 set lmargin at screen 0.05 set bmargin
> at screen 0.05 set rmargin at screen 0.40 set tmargin at screen 0.40
> plot 'left.dat'
> set size ratio 1.0/1.33 set rmargin at screen 0.95 set lmargin at screen
> 0.95 - 1.33*(0.35)
> set bmargin at screen 0.05 set tmargin at screen 0.40 plot 'left.dat'
> unset multiplot
> 
> There may well be simpler ways, but I'm not clear on exactly what
> arrangement you want.
> 
> 	Ethan

Thanks, that seems to do the job. (For some reason the ng system 
reformatted your text, sorry).
-- 
Dieter Britz

[toc] | [prev] | [next] | [standalone]


#1734

FromChristoph Bersch <usenet@bersch.net>
Date2013-03-26 15:57 +0100
Message-ID<kiscs1$brs$1@dont-email.me>
In reply to#1729
Hi,

Am 26.03.2013 10:30, schrieb Dieter Britz:
> I have the following multiplot
[...]
> However, I would like the right-hand one stretched
> in the x-direction by a factor, but to keep its
> vertical height.

I tried around a bit with 'set size ratio', but the x-size remained the 
same, only the y-size changed:

set size square
set multiplot layout 1,2
plot sin(x)
set size ratio 0.8
plot sin(x)
unset multiplot


What I can come up with is some manual corrections:

Use margins of the left plot using the GPVAL_TERM_* variables which are 
provided after the first plot (see with 'show variables all') to 
calculate fixed margins for the right plot:

set size square
set multiplot layout 1,2
set size 0.4,1
plot sin(x)
top_margin = (1.0*GPVAL_TERM_YMAX)/GPVAL_TERM_YSIZE
bottom_margin = (1.0*GPVAL_TERM_YMIN)/GPVAL_TERM_YSIZE
left_margin = (1.0*GPVAL_TERM_XMIN)/GPVAL_TERM_XSIZE
right_margin = (1.0*GPVAL_TERM_XMAX)/GPVAL_TERM_XSIZE
set size noratio
set tmargin at screen top_margin
set bmargin at screen bottom_margin
set lmargin at screen 0.5+left_margin - 0.05
set rmargin at screen 0.5+right_margin + 0.05
plot sin(x)
unset multiplot

I hope, this is not the best solution ;-)
Christoph

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web