[R] plotting Formulas with greek letters and variable values (expression, substitute, paste, ...)
rrookie1982
desser1 at uni-bonn.de
Mon Jan 18 08:14:27 CET 2010
rrookie1982 wrote:
>
> I want to write a formula of the type
>
> http://n4.nabble.com/file/n1016112/expression.gif
>
> into my plot, where the values 1.234 and -0.567 should origin from
> variables in the program.
>
Uwe Ligges-3 wrote:
>
> It is much easier, just write the formula down in R syntax and
> substitute the relevant variables as in:
>
> text(0, 7.5, substitute(tau(A) == a*lg(A^b), list(a=1.234, b=-0.567)))
>
Gabor Grothendieck wrote:
>
> Try bquote:
>
> a <- 0.1; b <- 0.2
> plot(0, main = bquote(tau(A) == .(a)*lg(A^.(b))))
>
Wow, those two examples are indeed much simpler than my tries and work just
fine. Now I just will have two choose which way to go:
> suba <- 1.234; subb <- -0.567
> text(0, 5,substitute(tau(A) == a*lg(A^b), list(a=suba, b=subb)),pos=4) ##
> and
> text(0, 5,bquote(tau(A) == .(suba)*lg(A^.(subb))),pos=4)
both work exactly how I wanted them to do.
Thank you Uwe and Gabor
--
View this message in context: http://n4.nabble.com/plotting-Formulas-with-greek-letters-and-variable-values-expression-substitute-paste-tp1016112p1016416.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list