[R] Rainbow Colored Scatter Plot
    Duncan Murdoch 
    murdoch at stats.uwo.ca
       
    Wed Jun 24 01:17:51 CEST 2009
    
    
  
On 23/06/2009 7:06 PM, Patrick Gedeon wrote:
> Hello,
> I have created a 3d scatter plot using the plot3d command in the rgl
> package. I have approximately 6500 data points in the scatter plot.
> 
> I would like to color these points sequentially using the entire color
> spectrum. (So the first point is red, next point slightly different, and
> each point gradually changes so that the final point is violet.) Is anyone
> familiar with how this can be done?
You won't get 6500 distinct colours (R uses 256 levels for each 
component, and that's not fine enough), but you can do something like this:
xyz <- cbind(rnorm(6500), rnorm(6500), 1:6500)
plot3d(xyz, col=rainbow(6500))
Duncan Murdoch
    
    
More information about the R-help
mailing list