[R] Complex superscript plot text
    Bob Farmer 
    rfarmer at uoguelph.ca
       
    Fri Mar 16 05:48:21 CET 2007
    
    
  
Hi all:
I would like to create a line of plot margin text (using mtext() ) that 
features both a superscript and a subset of an object.  However, I 
cannot seem to do both things at once, nor have I found a way to paste 
the two results together.
(I pull the object subset because this is part of a for-next loop to 
make multiple graphs)
This example doesn't give me what I want from mtext():
GoodnessOfFits<-c(1, 0.75)
graphNumber<-1  #first loop of the for-next loop (not shown)
x<-seq(-10, 10, 1)
y<-(x^2)
plot(x,y)
lines(x, predict(lm(y~I(x^2))))
mtext(text=
	expression(R^2 * ": "* GoodnessOfFits[graphNumber]))
I recognize that in this example, I could extract the R-squared value 
from the model in each loop, however this does not apply to my more 
complicated real scenario.
Any suggestions?
Thanks.
--Bob Farmer
    
    
More information about the R-help
mailing list