[R] Greek Letters for labeling persp-axis

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jan 6 10:57:03 CET 2003


salvatore barbaro wrote:
> Hi everybody,
> 
> on ?plotmath it can be seen that mathematical expressions like a
> greek letter could not be used for x- and y-axis labels in 'persp'
> plots. Unfortunately, this is exactly what I want to do: I need an
> expression(rho) to label the y-axes. Does anybody know a way to
> solve the problem. 

 From ?persp:
"xlab, ylab, zlab
  titles for the axes. N.B. These must be character strings; expressions 
are not accepted. Numbers will be coerced to character strings."

What you can do is to work around with text() (or mtext()) and the 
trans3d() function given in the examples in persp().


 > Further, Latex works very well by using the
> command tilde{y}^{[dip]} but I have some troubles in R (for
> instance, as a 'main' argument in a simple plot), probably due to
> the square brackets. The command expression(tilde(y)^(dip)) works,
> but what I want to get are indeed the square brackets.

See ?plotmath and look for "group" and "bgroup":
plot(1:10, main=expression(tilde(y)^group("[",dip,"]")))

Uwe Ligges




More information about the R-help mailing list