3d scatter chart in R using rgl plot3d - different size for each data point?

I use

plot3d(x,y,z, col=test$color, size=4) 

to build a three-dimensional scatterplot of my dataset with R, but with rglargument sizetakes only one size.

Is it possible to have different sizes for each data point, possibly with a different library, or is there an easy way around it?

Thanks for your ideas!

+3
source share
2 answers

Here is a detour along the same lines proposed by Etienne. The basic idea is to set up a graph, then use a separate call points3d()to plot points in each dimension 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, , plot3d(). , plot3d() material3d() , , material3d() only .)

material3d(size = 1:7)
# Error in rgl.numeric(size) : size must be a single numeric value
+6

, - , , . with(test, plot3d(x,y,z, col=test$color, size=test$size)).

, , , . - size = x/(max(x,na.rm=TRUE)-min(x,na.rm=TRUE)).

, material3d , , with, , material3d - , -, , , , , .

0

All Articles