David, 

Thank you very much for your response. 

Is there any chance you can provide your example where mtext is used? 

I also tried to use mtext, but I did not have any luck, so any help with the 
example below working with mtext or otherwise is greatly appreciated. 

Thanks again, 
Jason 





----- Original Message ----
From: David Scott <d.sc...@auckland.ac.nz>
To: Jason Rupert <jasonkrup...@yahoo.com>
Cc: "R-help@r-project.org" <R-help@r-project.org>
Sent: Wed, January 20, 2010 3:49:40 PM
Subject: Re: [R] Greek letters on a multi-line plot title

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.sc...@auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to