[R] Expression in plot text

Trent Piepho xyzzy at speakeasy.org
Wed Dec 6 19:56:33 CET 2000


I'd like to put a degree symbol in the title of a plot.  Something like:

plot(1,main=expression("Data at " * 45 * degree * " North"))

That works fine, but I like the 45 to be the value of a variable, instead of a
constant, an in:

lat <- 45
plot(1,main=expression("Data at " * lat * degree * " North"))

But this doesn't work of course, the graph title is "Data at lat° North".  If
I try to paste expressions and strings together, that doesn't work either.

Now, I can figure out how to stick an ASCII 176 character into a text file and
get an actual degree symbol inside a literal string that way, though it's
rather a pain, and it shows up as "45\260 North" in an xterm.  But what if I
want some other kind of expression that I can't just type in as a string?

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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