Here's a work-around along the same lines suggested by Etienne. The key idea is to set up the plot, then use a separate call to points3d()
to plot the points in each size class.
# Break data.frame into a list of data.frames, each to be plotted
# with points of a different size
size <- as.numeric(cut(iris$Petal.Width, 7))
irisList <- split(iris, size)
# Setup the plot
with(iris, plot3d(Sepal.Length, Sepal.Width, Petal.Length, col=Species, size=0))
# Use a separate call to points3d() to plot points of each size
for(i in seq_along(irisList)) {
with(irisList[[i]], points3d(Sepal.Length, Sepal.Width,
Petal.Length, col=Species, size=i))
}
(FWIW, it does appear that there's no way to get plot3d()
to do this directly. The problem is that plot3d()
uses the helper function material3d()
to set point sizes and as shown below, material3d()
only wants to take a single numeric value.)
material3d(size = 1:7)
# Error in rgl.numeric(size) : size must be a single numeric value