[R] rgl: axis/viewport/box problems in persp3d()
Marius Hofert
m_hofert at web.de
Fri Sep 9 12:18:07 CEST 2011
Dear expeRts,
I am a new user of rgl, below is my first trial to plot a simple function in 3d.
I managed to put the axes in the right locations, but:
(1) The xlab, ylab, and zlab arguments are ignored; how can I put in axes labels?
(2) Since I removed the axes in persp3d() the viewport is too small; is it possible
to keep the size of the viewport?
(3) The box is not correctly drawn, there are two "holes", one in (0,0,1) and one
in (1,1,0); how can I fix that?
Cheers,
Marius
require(rgl)
s <- seq(0, 1, length.out=21)
M <- function(u) apply(u, 1, min)
u <- s
v <- s
z <- outer(u, v, function(u,v) M(cbind(u,v)))
persp3d(u, v, z, aspect="iso", front="line", lit=FALSE, axes=FALSE, xlab="",
ylab="", zlab="")
axes3d(edges=c('x--','y--','z+-'), xlab="x", ylab="y", zlab="z")
par3d(windowRect=c(0,0,480,480))
R1 <- rotationMatrix(-55*pi/180, 1,0,0)
R3 <- rotationMatrix(50*pi/180, 0,0,1)
R <- R1 %*% R3
rgl.viewpoint(interactive=TRUE, userMatrix=R) # rotate
rgl.postscript("myplot.pdf", fmt="pdf")
More information about the R-help
mailing list