[R-sig-eco] Graphing Envfit Output

Jari Oksanen jari.oksanen at oulu.fi
Wed Nov 9 07:17:55 CET 2011


On 9/11/11 00:52 AM, "Stephen LeDuc" <sdleduc at gmail.com> wrote:

> Dear R Listserve,
> 
> I'd like to take my results from the envfit function in the vegan package,
> such as those below, and make a vector plot in a graphing package like
> Sigma Plot. When graphed in R, it is my understanding that the results
> are scaled depending upon the plot axes.  Does R just multiply each
> dimensional value (Dim1, Dim2) by a scaler to get X and Y coordinates for
> each arrow endpoint?  If so, is there a way to view the scaler for each
> given axis?  Any help on this would be greatly appreciated. Best, Steve
> 
> ***VECTORS
>                Dim1      Dim2     r2 Pr(>r)
> Mineral.N  0.125899  0.992043 0.5715 0.3127
> AA_N       0.998794 -0.049102 0.8172 0.1283
> SON        0.984886  0.173203 0.7901 0.1235
> FF_C      -0.222764  0.974872 0.5052 0.3463
> P         -0.034731 -0.999397 0.1737 0.7537

Steve,

There are two different scaling issues: (1) scaling arrows against each
other, and (2) scaling the bunch of arrows to fit the ordination graph.

(1) The coordinates above are direction cosines or the coordinates of the
heads of unit-length arrows. The envfit plot() function scales these arrows
by their correlations (square root of column r2) so that 'P' will be longer
than 'SON' in your example above. If you want to see the scaled arrows, you
should use function scores() for the envfit() result. If you want to get the
unit length arrows, you cannot use scores() but you must directly access
envfit_result$vectors$arrows.

(2) The bunch of r-adjusted arrows is scaled to fill the current graph. An
internal vegan function ordiArrowMul() that finds the multiplier for the
current plot. Replotting ordination in different size will change the
multiplier. The ordiArrowMul() is unexported in vegan 2.0-* so that you must
call it as vegan:::ordiArrowMul() to see the current multiplier. This
multiplier concerns the r-adjusted arrows which you can see with scores(...,
display="vectors").

The arrow scaling has been asked before, and therefore I thought this is a
FAQ, and therefore I have something in
http://vegan.r-forge.r-project.org/FAQ-vegan.html

This seems to cover only point (2) above. If you think that this FAQ needs
improvement and clarification, please let me know, and we'll fix the FAQ.

Cheers, Jari

-- 
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
jari.oksanen at oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa



More information about the R-sig-ecology mailing list