[R] legend(1,1,expression(a<-"10^-6"))
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Apr 27 09:28:14 CEST 2004
Viet Nguyen wrote:
> hi all,
>
> I have a problem with showing properly formated mathematical expressions
> in a plot.
>
> The following works:
>
> plot(1:10)
> legend(1,10, expression(10^-6))
>
> Howver, if my expression is kept in a char variable, I don't know how to
> show it in the legend.
>
> # I have
> st_"10^-6"
You have got a completely outdated version of R, if the code given above
really works. Note that _ has long been depeceated and does no longer
work for assignments.
> # I try to do this
> plot(1:10)
> legend(1,10, expression(st))
> # which doesn't turn out as expected
>
?parse: "parse returns the parsed but unevaluated expressions in a list.
Each element of the list is of mode expression."
st <- "10^{-6}"
plot(1:10)
legend(1,10, parse(text = st))
Uwe Ligges
> Is it possible to convert a string into expression? Or is there a
> different way of doing what I want to do?
>
> Thanks in advance for your help.
> viet
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list