Hi, I am doing composite plots with the package plot3D. One of my variables is
qualitative and indexed to integers, and I would like the legend for it to have
labels located at the integer values (midpoints), and not at the breaks between
classes. In the example below, the Elev Classes legend has labels at the breaks
and nothing at the midpoints. How can I show the class labels at 1:3, and not
the breaks?
library(plot3D)
persp3D(z = volcano, zlim = c(-60, 200), phi = 20,
colkey = list(length = 0.2, width = 0.4, shift = 0.15,
cex.axis = 0.8, cex.clab = 0.85), lighting = TRUE, lphi = 90,
clab = c("","height","m"), bty =
"f", plot = FALSE)
# classify the volcano elevations with 3 classes
elev.classes <- matrix(findInterval(volcano, vec = seq(50, 200, by=50)),
nrow=nrow(volcano), ncol=ncol(volcano))
class.colors <- c("red", "blue", "green")
# add as image with own color key, at bottom
image3D(z = -60, colvar = elev.classes, add = TRUE,
col = class.colors, breaks = seq(0.5, 3.5, by=1),
colkey = list(length = 0.2, width = 0.4, shift = -0.15,
cex.axis = 0.8, cex.clab = 0.85, addlines=TRUE,
tick=FALSE,
at = 1:3, labels=paste("Class", 1:3)),
clab = c("","Elev Classes"), plot = TRUE)
Thanks,
Scott
Scott Waichler
Pacific Northwest National Laboratory
Richland, Washington, USA
scott.waichler at pnnl.gov