[R] persp and greek symbols in the axes labels

Stephen Tucker brown_emu at yahoo.com
Tue Jul 24 10:55:55 CEST 2007


I don't know why it doesn't work but I think people generally recommend that
you use wireframe() in lattice rather than persp(), because wireframe is more
customizable (the pdf document referred to in this post is pretty good):
http://tolstoy.newcastle.edu.au/R/e2/help/07/03/12534.html

Here's an example:

library(lattice)
library(reshape)
x <- 1:5
y <- 1:3
z <- matrix(1:15,ncol=3,dimnames=list(NULL,y))
M <- melt(data.frame(x,z,check.names=FALSE),id=1,variable="y")
wireframe(value~x*y,data=M,
          screen=list(z=45,x=-75),
          xlab=expression(kappa[lambda]),
          ylab=as.expression(substitute(paste(phi,"=",true,sigma),
              list(true=5))),
          zlab = "Z")

[you can play around with the 'screen' argument to rotate the view, analogous
to phi and theta in persp()]


--- Nathalie Peyrard <Nathalie.Peyrard at toulouse.inra.fr> wrote:

> Hello,
> 
> I am plotting a 3D function using persp and I would like to use greek 
> symbols in the axes labels.
> I  have found examples like  this one on the web:
> 
>
plot(0,0,xlab=expression(kappa[lambda]),ylab=substitute(paste(phi,"=",true,sigma),list(true=5)))
> 
> this works well with plot but not with persp:
> with the command
> 
> persp(M,theta = -20,phi = 
>
0,xlab=expression(kappa[lambda]),ylab=substitute(paste(phi,"=",true,sigma),list(true=5)),zlab
> 
> = "Z")
> 
> I get the labels as in toto.eps
> 
> Any suggestion? Thanks!
> 
> Nathalie
> 
> -- 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
> INRA  Toulouse - Unité de Biométrie et  Intelligence Artificielle 
> Chemin de Borde-Rouge BP 52627 31326 CASTANET-TOLOSAN cedex FRANCE 
> Tel : +33(0)5.61.28.54.39 - Fax : +33(0)5.61.28.53.35
> Web :http://mia.toulouse.inra.fr/index.php?id=217
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> > ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



       
____________________________________________________________________________________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV.



More information about the R-help mailing list