[R] Using axis limits with plot3D

Waichler, Scott R Scott.Waichler at pnnl.gov
Thu Aug 7 01:21:04 CEST 2014


I would like to use the functions in the plot3D package but I am having trouble getting the axis limits to work correctly.  The slices plotted by the code below go beyond the bounds of the persp box and obscure the axis information.  How can I show just the part of the domain within x.limits and y.limits?

library(plot3D)
x <- z <- seq(-4, 4, by=0.2)
y <- seq(-6, 6, by=0.2)
M <- mesh(x,y,z)
R <- with(M, sqrt(x^2 + y^2 +z^2))
p <- sin(2*R)/(R+1e-3)
x.limits <- c(-2, 2)
y.limits <- c(-2, 2)
slice3D(x,y,z, colvar=p, xs=0, ys=c(0, 4), zs=NULL, xlim=x.limits, ylim=y.limits, scale=F, ticktype="detailed")

Thanks,
Scott Waichler
Pacific Northwest National Laboratory
Richland, WA, USA



More information about the R-help mailing list