Fernando (Est - UnB)
2011-Jun-18 19:47 UTC
[R] [rgl] Dynamically change the color of 3d objects
Hi, I'm new here. This question concerns the package rgl. Is it possible to change the colour of a set of points drawn with plot3d /without/ removing them from the scene? The idea is to create a presentation of a clustering algorithm, step by step, representing the currently assigned cluster by a colour. Removing all the points with "rgl.pop" and replotting them at each step works, but is kinda slow... Thanks! Fernando.
On 11-06-18 3:47 PM, Fernando (Est - UnB) wrote:> Hi, > > I'm new here. > > This question concerns the package rgl. > > Is it possible to change the colour of a set of points drawn with > plot3d /without/ removing them from the scene?No, you can't modify objects other than by removing and recreating them.> > The idea is to create a presentation of a clustering algorithm, step > by step, representing the currently assigned cluster by a colour. > Removing all the points with "rgl.pop" and replotting them at each > step works, but is kinda slow...If you do it this way: # plot the points, and save the id in pointsID par3d(skipRedraw=TRUE) rgl.pop(pointsID) pointsID <- points3d( ... ) # plot the points again par3d(skipRedraw=FALSE) it will go faster, and appear to the viewer as though the colour just changed, with no removal of points. Duncan Murdoch