Skip to content
Prev 171229 / 398506 Next

3D or 4D plot

On 2/20/2009 1:46 PM, kapo coulibaly wrote:
There's no primitive "cube" symbol in rgl, but you can get an array of 
colour-coded spheres:

x <- rep(1:3, each=9)
y <- rep(rep(1:3, each=3), 3)
z <- rep(1:3, 9)
colours <- terrain.colors(27)
plot3d(x,y,z,col=colours, type="s", size=10)

If you really want cubes, you can put them together (start with cube3d() 
to get one, and build on that), but it's a lot of work.

Duncan Murdoch