help-octave
[Top][All Lists]
Advanced

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

RE: Two lined title on plot


From: William Krekeler
Subject: RE: Two lined title on plot
Date: Tue, 5 Apr 2011 16:48:11 +0000


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Martin Helm
Sent: Tuesday, April 05, 2011 11:16 AM
To: address@hidden
Cc: dirac
Subject: Re: Two lined title on plot

Am Dienstag, 5. April 2011, 17:51:49 schrieb dirac:
> hi there,
> 
> I have been trying to put a two lined title on to a plot I am working 
> on at the moment. I have seen some suggestions from the matlab forum already:
> 
>   title({'line1','line2'})
> 
>   and
> 
>   title('line1 \newline line2')
> 
> But they both don't work. I don't know if it is because I am using a 
> macbook or if these commands don't work in Octave. I also saw another 
> solution from the Octave (this!) forum:
> 
>   title("foo\nbar")
> 
> But this doesn't work for my problem where I am concatenating things 
> in the
> command:
> 
>   title(cstrcat('Normalised Histogram and Gaussian fit of the 
> ',num2str(days),' daily returns for the stock AstraZeneca PLC'))
> 
> 
> 
> Is there a way to put this on two lines?
> Thanks
> Martin
> 

This example works well with 3.4

title(cstrcat("Normalised Histogram and Gaussian fit \nof the ",num2str(days)," 
daily returns\n for the stock AstraZeneca PLC"))

(Just for fun I used 3 lines)
You have to use "" for the strings.


Why not embed sprintf inside the title command? Then you can control how the 
days are printed, precision of float values, etc.

        title( sprintf( 'string1\nstring2' ) )

Bill Krekeler


reply via email to

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