Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

biological neural network - How can I plot cubes in R?

Can you please help me understand this methodology called "Bambachian Mega Guild" (Bambach et al., 2007). This methodology tries to locate the Tiering, Feeding and Motility variables of the species according to the percentage of their appearance within a 3D cube. I want to try to understand which package to use to make this plot in R, since the truth is that I am not very clear about how to design these cubes as you can see them in the attached image.

Bush, A. M., Bambach, R. K., & Daley, G. M. (2007). Changes in theoretical ecospace utilization in marine fossil assemblages between the mid-Paleozoic and late Cenozoic. Paleobiology, 33(01), 76–97. doi:10.1666/06013.1

enter image description here

question from:https://stackoverflow.com/questions/65661707/how-can-i-plot-cubes-in-r

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I haven't seen that kind of display from an existing R package (though it might exist). You could probably build it up yourself using the rgl package, e.g. this code

library(rgl)
locations <- cbind(x = rep(1:6, 36), y = rep(rep(1:6, 6), each = 6), 
                   z = rep(1:6, each = 36))
colors <- sample(c("white", "blue", "red"), 216, 
                 rep=TRUE, prob=c(0.9, 0.1, 0.1))
for (i in 1:216)
  shade3d(translate3d(cube3d(scaleMatrix(0.3, 0.3, 0.3), col = colors[i]), 
                      x=locations[i,1], y = locations[i, 2], z = locations[i, 3]))

produces this figure

screenshot

However, that would be a lot of work. If you wanted to display the data, but not necessarily in a fake 3D plot, the mosaicplot() in the base graphics package might be able to do what you want, depending on what your data is like. Including some sample data in your question (using dput(<your data>)) would make it easier to answer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...