[R] plotmath help with expression
stephen sefick
ssefick at gmail.com
Wed Sep 3 20:18:28 CEST 2008
reg.line <- function(y, x, title)
{plot(y~x, main=title, xlab="TSS", ylab="Aluminum")
line <- lm(y~x)
d <- summary(line)
legend("topleft", legend=paste(expression(r^2), "=" ,d$r.squared,
sep=" "), bty="n")
abline(line)}
reg.line(1:10, 10:1, "line")
how do I get the legend to print the plotmath symbol expression(r^2) ?
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.
-K. Mullis
More information about the R-help
mailing list