On Wed, 03-Sep-2008 at 02:18PM -0400, stephen sefick wrote: |> 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) ?
I think you want your 'paste' part to look something like this: legend = substitute(r^2 == rsq, list(rsq = d$r.squared)) It's quite a different approach from what is used with paste. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Middle minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.