[R] 3d cube with labels along axes

jonne newsreader at zutt.org
Thu Sep 1 16:05:34 CEST 2005


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.




More information about the R-help mailing list