[R] 3d cube with labels along axes

Felipe Csaszar fcsaszar at gmail.com
Fri Sep 2 09:16:04 CEST 2005


This may work:
- use option axes=F in persp
- use locator() to get the coordinates where you want to put your new labels
- use text(x,y,...) to write your new labels

It is a little bit tedious, but it should work. Regards,

Felipe



"jonne" <newsreader at zutt.org> wrote in message 
news:pan.2005.09.01.14.05.34.548177 at zutt.org...
> Hi R-users,
>
> I would like to draw a cube with a grid on it and labels along all
> three axes. I have trouble printing the labels correctly. My
> best attempt is described below.
>   Can somebody explain me how I can change the 0,20,40,80,100
> along the x axis into character vectors like
> "no", "light", "intermediate", "severe" ?
>
> x <- seq(0, 100, length=10)
> #x <- c("no", "light", "intermediate", "severe")
> y <- x
> f <- function(x,y) { numeric(length=100) + 5 }
> z <- outer(x, y, f)
>
> P <- persp(x, y, z, theta=30, phi=30, zlim=c(-10,10), ticktype="detailed")
>
> text3d(0, 0, -10, "Hello world", P)
>
> Thanks in advance,
> Jonne.
>
> ______________________________________________
> 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
>




More information about the R-help mailing list