Jason Rupert wrote:> I have an instance where I need to include Greek letters on a plot title
that is multiple lines.
>
> I've searched the forums for an approach to do this, but most of the
previous posts and replies seem to just address instances of single line
examples and problems:, e.g.
>
> https://stat.ethz.ch/pipermail/r-help/1999-October/005096.html
>
> I tried implementing those suggestions, e.g.
"expression(paste(...))", but that seemed to remove all the line split
formating, i.e. "\n".
>
> In the example code below I would like the sigma to be the lower case Greek
symbol for sigma. Actually I would like the x and y to be subscripts of the
lower case Greek symbol, but I suppose that is the next step. I guess the key
is that I would like to maintain the multiple line title while having the Greek
letters.
>
> Thanks again for any feedback. and insights.
>
>
>
> number_vals<-100
> x<-rnorm(number_vals)
> y<-rnorm(number_vals)
> plot(1, 1,
> xlim= c(min(x), max(x)),
> ylim= c(min(y), max(y)), col=0)
> points(x, y)
> the_expression<-paste("Plotting y vs. x",
> "\n sigma x = ", format(sd(x), digits=4,
scientific=F),
> "\n sigma y = ", format(sd(y), digits=4,
scientific=F), sep="")
>
> title(the_expression)
> grid()
>
When confronted with this problem, after many failed attempts, I have
had to resort to mtext.
David Scott
--
_________________________________________________________________
David Scott Department of Statistics
The University of Auckland, PB 92019
Auckland 1142, NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018
Director of Consulting, Department of Statistics