[R] text-plotting math & regular mixed ?

Martin Maechler maechler at stat.math.ethz.ch
Tue Jun 29 14:58:10 CEST 1999


Maybe embarassing, but I can't quickly find out how to do this:

Mix expression() text and regular text __in a variable__ for plotting:

I can easily do

plot(1,type="n",main=expression(paste("Plot of ", x ^ alpha, "; ", alpha==2.3)

However, if alpha is really just in a variable, I don't know what to do

  alpha <- 2.3
  ch.a <- format(alpha)

and now do the above but only use  `ch.a' ?

i.e., can you ``fix'' the following function ?

p.ex <- function(alpha = .05) {

     x <- seq(0,1, len=101)
     ch.a <- formatC(alpha,wid=1)
     plot(x, x^alpha, main= 
	  expression(paste("Power plot of ", x ^ alpha, " for ", alpha == {})))
     ## Where can I pass  ch.a ??			  
     invisible()			  
}

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list