[R] envfit vector labels with ordiplot3d

Jari Oksanen jari.oksanen at oulu.fi
Fri Sep 9 13:17:40 CEST 2011


Briony <brionynorton <at> gmail.com> writes:

> 
> Hi R experts,
> 
> I'm looking for some help with plotting vectors from envfit in vegan, onto a
> 3d plot using ordiplot3d. So far I have
> 
> data.mds <- metaMDS(data, k=3,trace = FALSE)
> vect_data<-envfit(data.mds,vegdata[,3:21],choices=1:3,permu=9999)
> ordiplot3d(data.mds,envfit=vect_data)
> ordixyplot(data.mds,pch=pts,envfit=vect_data)
> 
> (my data's not really called data, I thought it might be easier to
> communicate this way)
> 
> These display the vectors as arrows, but what I would really like is for the
> arrows to be labelled, like what comes up automatically in ordirgl or with a
> 2D ordiplot.
> 
> I've gone through the help and tried everything I can work out, but I must
> be missing something important, because nothing's worked so far. I would be
> happy to use ordixyplot and show a series of 2D plots, but I can't get
> labels on those arrows either. 
> 
> Any pointers in the right direction would be gratefully received.
> Briony

Briony,

There really is no way to do this automatically, but if someone fixes the
functions, we are happy to incorporate those changes in vegan. 

You may be able to achieve something like that with ordiplot3d, but I am
not sure it looks completely satisfactory. Function ordiplot3d returns 
invisibly the plotting object which contains, among other items. the
coordinates of arrow heads in the  flattened graph. So this could work:

pl <- ordiplot3d(data.mds,envfit=vect_data)
ordilabel(pl$arrows)

Function ordiplot3d uses scatterplot3d, and it returns also all 
scatterplot3d items, like functions xyz.converter and points3d that
can be used for tuning labels.

With ordixyplot I can see no other choice than that you edit the
function and preferably contribute your edited function to vegan 
(and will be credited with the function help).

Cheers, Jari Oksanen



More information about the R-help mailing list