Hi, I want to use a discrete color ramp with plot3D, and show NA values as white
(default). I get unexpected results per the following.
# as in help(slice3D) example:
par(mfrow = c(2,2))
x <- y <- z <- seq(-1, 1, by = 0.1)
grid <- mesh(x, y, z)
colvar <- with(grid, x*exp(-x^2 - y^2 - z^2))
slice3D (x, y, z, colvar = colvar, theta = 60)
#
# use three discrete classes and colors instead of a continuous ramp
slice3D(x, y, z, colvar = colvar, theta = 60,
col = c("blue", "green", "red"), breaks =
c(-0.5, -0.1, 0.1, 0.5))
# now set a vertical slice of the cube to NA
colvar[10,,] <- NA
# displays as expected; default NAcol = "white"
slice3D (x, y, z, colvar = colvar, theta = 60)
# does not display as expected--notice
# the colors shifted down in value, with NA and -0.5 to -0.1 now both white.
slice3D(x, y, z, colvar = colvar, theta = 60,
col = c("blue", "green", "red"),
breaks = c(-0.5, -0.1, 0.1, 0.5))
Please help. Thanks,
Scott
Scott Waichler, PhD
Pacific Northwest National Laboratory
scott.waichler at pnnl.gov
Richland, Washington, USA