help-octave
[Top][All Lists]
Advanced

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

Re: Main title in plot


From: Guido Walter Pettinari
Subject: Re: Main title in plot
Date: Wed, 9 Dec 2009 19:19:53 +0000

Hi,

yes it does, thank you. However I was hoping a shorter way to accomplish the 
same result existed. For example, something like:

maintitle ( "Main Title" ),

would be really useful.

Cheers,

Guido

On 9 Dec 2009, at 17:57, Ben Abbott wrote:

> 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]