[R] scatter3d with groups

David Winsemius dwinsemius at comcast.net
Wed Dec 2 23:31:37 CET 2009


On Dec 2, 2009, at 5:01 PM, Philippe Thomas wrote:

> David Winsemius schrieb:
>>
>> On Dec 2, 2009, at 4:09 PM, Philippe Thomas wrote:
>>
>>> Dear R users,
>>>
>>> I'm currently visualizing my data using scatter3d from the "Rcmdr"  
>>> package. I have  data points which can be separated in two  
>>> classes. Data points from class 'A' should be colourised red and  
>>> data points in class 'B' should be colourised 'blue'. No matter  
>>> what I try, the data points are always blue.
>>>
>>> I attached a (very) minimal example to reproduce my problem.
>>>
>>> Thanks,
>>>  Philippe
>>>
>>> library("Rcmdr")
>>>
>>> scatter3d(x=c(1,2), y=c(1,2), z=c(1,2),
>>>        groups=as.factor(c(1,2)),
>>>        point.col=c('red','blue'), surface=F)
>>
>> Now that is weird! (I'm not a regular user of Rcmdr.) I didn't  
>> think that rgl would run under the 64 bit R, but there does seem to  
>> be a functioning rgl widow that comes up. Hmmm .... Need to  
>> investigate this further. Looks promising.
>>
>> Dropping the groups term corrects your color problem, so the colors  
>> are probably <somehow> being derived from the numerical  
>> underpinnings of the group factor.
>>
>> -- 
>>
> Hi David,
>
> thanks for your answer. Dropping the groups term does not solve my  
> problem. After dropping the term  both data points have a red colour.

Then it's probably time to compare details from your sessionInfo(),  
capabilities(), and system specs. I'm on a Mac running with the R64  
GUI and graphics devices vary quite a bit across the range of OSes.

Just to be clear this was my function:

scatter3d(x=c(1,2), y=c(1,2), z=c(1,2),
         point.col=c('red','blue'), surface=F)

 >  capabilities()
     jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets
     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE
   libxml     fifo   cledit    iconv      NLS  profmem    cairo
     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE

 > sessionInfo()
R version 2.10.0 Patched (2009-10-29 r50258)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] mgcv_1.5-6           rgl_0.87             Rcmdr_1.5-3
[4] car_1.2-16           scatterplot3d_0.3-29

loaded via a namespace (and not attached):
[1] grid_2.10.0     lattice_0.17-26 nlme_3.1-96     tools_2.10.0

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list