[R] scatter3d: problem with spheres-color

Duncan Murdoch murdoch.duncan at gmail.com
Thu Apr 12 23:37:09 CEST 2012


On 12/04/2012 2:27 PM, John Fox wrote:
> Dear René,
>
> I've confirmed that the spheres aren't coloured correctly on my Ubuntu system (the first colour is used for all of the spheres), and I know that this works right on Windows, as you mentioned. I'm curious to try it on my Mac, but don't have that handy at the moment.
>
> I also looked at the code for scatter3d.default(), and that is pretty straightforward; scatterplot3d.default() draws the spheres with the command
>
>      rgl.spheres(x, y, z, color = surface.col[as.numeric(groups)],
>                  radius = size)
>
> I'm copying this response to Duncan Murdoch (the coauthor and maintainer of the rgl package) in case he has any insight into the problem.
>
> Thank you for drawing this issue to my attention.


Calling rgl.spheres looks dangerous to me:  the rgl.* functions make 
permanent changes to material properties.  Generally it's safer to call 
spheres3d, as all of the *3d versions of functions make local changes.

But there should be no differences in that between Ubuntu and Windows.  
Can you put together a simple example that does give differences?  For 
example, on Windows this gives 5 different colours:

rgl.spheres(1:5, 1:5, 1:5, col=1:5, radius=(1:5)/10)

My preferred version would be

spheres3d(1:5, 1:5, 1:5, col=1:5, radius=(1:5)/10)

Do they behave the same?

Duncan Murdoch



More information about the R-help mailing list