[R] mathematical expression in legend

Paul Murrell p.murrell at auckland.ac.nz
Wed Mar 13 00:48:11 CET 2002


> I'm trying to put a mathematical expression into a legend, but R
> complains about a syntax error. Basically i'd like to do this:
> legend.text = c(expression(x < 10), expression(x >= 10))

The following works for me on 1.4.0 (yukky alignment which should be fixed
in 1.4.1) ...

    plot(1:20, pch=rep(1:2, c(9, 11)))
    legend(6, 4, c(expression(x < 10), expression(x >= 10)), pch=1:2)

> The manual says that one can only pass mathematical expressions to axis,
> text etc. but not to the legend command?

Could you let us know where it says that -- sounds like it will need fixing.


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