[R] LaTeX in R
Thomas Lumley
tlumley at u.washington.edu
Fri Jul 30 17:42:28 CEST 2004
On Fri, 30 Jul 2004, Roy, Supratik wrote:
>
> I tried to include LaTeX expressions in the header of a plot in R.
> (1) Using PlotMath, LaTeX type expressions, e.g., R^x is possible, however,
> dist<-"...." (some string)
> ....main=expression(R^x,dist)....
> does not substitute the value of dist, as well do the proper superscripting.
> Also within an expression, substitute does not work, (apparently), so that
> explicit substituting of "dist" does not take place.
Working from the example in FAQ 7.15 suggests something like
dist=" is the xth power of R"
plot(rnorm(10),main=substitute(R^x*dist,list(dist=dist)))
which works fine. A slightly more compact version is
plot(rnorm(10),main=bquote(R^x*.(dist)))
If that output isn't what you want you will need to explain what you want
more precisely.
-thomas
More information about the R-help
mailing list