[R] text-plotting math & regular mixed ?

Martin Maechler (maechler@stat.math.ethz.ch)
Tue, 29 Jun 1999 14:58:10 +0200

Date: Tue, 29 Jun 1999 14:58:10 +0200
Message-Id: <199906291258.OAA10869@sophie.ethz.ch>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-help@stat.math.ethz.ch
Subject: [R] text-plotting math & regular mixed ?

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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


This archive was generated by hypermail 1.02.