[R] 3d Scatterplot using rgl

Olivier ETERRADOSSI olivier.eterradossi at ema.fr
Mon May 11 12:54:40 CEST 2009


Hi Zoé,
try
plot3d(swadt[,1],swadt[,2],swadt[,3],radius=swadt[,4],type="s")

Hope this helps. regards. Olivier


Zoe Hoare wrote:
> 
> Hi,
> I am trying to plot a 3d scatter plot using the rgl package but am having
> trouble.
> I have a matrix containing x, y and z co-ordinates and a fourth element
> related to a count variable. 
> I would like to plot the points using plot3d with the sizes of the points
> related to the fourth element in the matrix. Is this possible with plot3d
> or do I need to use something else?
> 
> I include a small example of what I am trying to do
> 
>  swadt
>  A   B  C    run1 run2 run3 run4 run5 run6
>   93  96 51  0.1   NA  0.1   NA   NA   NA
>   93  97 50  0.3   NA   NA  0.1   NA   NA
>   93  98 49  0.1   NA   NA   NA   NA   NA
>   94  95 51   NA   NA   NA   NA   NA  0.1
>   94 100 46  0.1   NA   NA   NA   NA   NA
>   94  96 50  2.1  0.1  1.0  0.7  0.8  0.4
>   94  97 49  3.2  0.9  1.9  1.9  1.6  1.6
>   94  98 48  0.9   NA  0.3  0.4  0.5  0.1
>   95  94 51   NA   NA   NA  0.1  0.1   NA
>   95  95 50  3.4  0.7  2.8  2.4  2.9  2.3
>   95  96 49 12.5 13.4 13.6 15.0 15.3 17.1
>   95  97 48 10.2 10.8  8.9 10.8  8.7  9.3
>   95  98 47  1.5   NA  0.9  0.7  0.8  0.1
>   96  93 51  0.1   NA   NA   NA   NA   NA
> 
> If I use
> plot3d(swadt[,1],swadt[,2],swadt[,3],size=swadt[,4])
> I get the following error
> Error in rgl.numeric(size) : size must be a single numeric value
> 
> Is there a way of plotting this?
> Thanks
> Zoe Hoare
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/3d-Scatterplot-using-rgl-tp23480170p23481038.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list