Re: [R] [rgl] Dynamically change the color of 3d objects

2011-06-19 Thread Duncan Murdoch

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [rgl] Dynamically change the color of 3d objects

2011-06-19 Thread Fernando (Est - UnB)
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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.