[R] Greek letters on a multi-line plot title

Jason Rupert jasonkrupert at yahoo.com
Wed Jan 20 19:45:52 CET 2010


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()

 
 
 
Oh yeah...
> sessionInfo(package=NULL)
R version 2.9.2 (2009-08-24) 
i386-pc-mingw32 






More information about the R-help mailing list