[R] scatter3d: problem with spheres-color

René Mayer mayer at psychologie.tu-dresden.de
Fri Apr 13 11:32:47 CEST 2012


Dear John and Duncan,

thanks for your ideas! Unfortunatly, calling spheres from rgl
did not resolve the problem on my machine.

Both - spheres3d() and rgl.spheres() -
behave the same: black spheres, all aqual colored.
The only difference beeing the looking angle and thebackround color.
Seems to me that the 'col=1:5' argument is completly ignored.

René



Zitat von "Duncan Murdoch" <murdoch.duncan at gmail.com>:

> 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