[R] points3d and ordirgl

Duncan Murdoch murdoch.duncan at gmail.com
Fri Dec 7 13:15:56 CET 2012


On 12-12-06 7:20 PM, Aaron Wells wrote:
> Hello all, I have been using the function ordirgl to plot 3D dynamic
> ordinations.  The ordirgl function works just fine. IN fact, I was even
> able to write a function that allows me to identify points in the 3D plot:
>
> identify.rgl<-function(env_var,ord,dim1,dim2,dim3)
>
> {
>          tmp<-select3d(button="left")
>          tmp.keep<-tmp(ord[,dim1],ord[,dim2],ord[,dim3])
>          env_var[tmp.keep=="TRUE"]
> }
>
> where
> env_var = a variable to be identified (e.g. plot IDs as in >
> row.names(dataframe))
> ord = ordination points or scores created using a function such as metaMDS
> or nmds) that is recognized by points or scores
> dim1 = dimension 1 (e.g., 1)
> dim2 = dimension 2 (e.g., 2)
> dim 3 = dimension 3 (e.g, 3
>
> e.g.,  > identify.rgl(row.names(vegmat),veg_nmds$points,1,2,3)
>
> My issue is that I would like to use the points3d function to add points of
> different colors and sizes to the dynamic 3D plot created by using ordirgl.
> In my case the different colored and sized points represent different
> clusters from the results of the Partitioning Around Mediods (pam)
> clustering function (from library cluster).  I have used this with success
> in the past (two years back), but can't get it to work properly  now. An
> example of the code I have used in the past is:
>
>>
> points3d(veg_nmds$points[,1],veg_nmds$points[,2],veg_nmds$points[,3],display
> = "sites",veg_pam12$clustering=="1",col=2,size=3)

Where are you finding the points3d function?  The one in rgl doesn't 
have a "display" argument.  The logical argument that follows it doesn't 
seem to make sense either.

>
> The code above is intended to add the points from cluster 1 to the nmds
> plot in the color red and size 3.

If you want red, it's slightly safer to use "red" instead of 2, because 
someone might have changed the palette.

Duncan Murdoch

>
> Anyone have an ideas?
>
> Thanks,
>         Aaron
>
> 	[[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.
>




More information about the R-help mailing list