help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Main title in plot


From: Ben Abbott
Subject: Re: Main title in plot
Date: Wed, 09 Dec 2009 12:57:53 -0500

On Wednesday, December 09, 2009, at 12:32PM, "Guido Walter Pettinari" 
<address@hidden> wrote:
>Hello everybody!
>
>I am trying to print a title in a plot composed by several subplots.
>
>For example, in
>
>subplot ( 1, 2, 1)
>fplot ( @sin, [0, 2*pi] )
>title ('sin')
>subplot ( 1, 2, 2)
>fplot ( @cos, [0, 2*pi] )
>title ('cos')
>
>how do I add a main title so that it appears on top of the two adjacent plots?
>
>Thank you,
>
>Guido

Does this do what you want ...

figure(1)
clf

subplot ( 1, 2, 1) 
fplot ( @sin, [0, 2*pi] ) 
title ("sin") 
a1 = gca ();
p1 = get (gca, "position");
subplot ( 1, 2, 2) 
fplot ( @cos, [0, 2*pi] ) 
title ("cos") 
a2 = gca ();
p2 = get (gca, "position");

p3 = [p1(1), p1(2), p2(1)-p1(1)+p2(3), p2(2)-p1(2)+p2(4)];
axes ("position", p3)
axis off
title ("Main Title")

p1(4) = p1(4)*0.9;
p2(4) = p2(4)*0.9;
set (a1, "position", p1)
set (a2, "position", p2)

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]