[R] plot.envfit/move labels

Peter Ehlers ehlers at ucalgary.ca
Thu Nov 5 20:31:19 CET 2009


Kim Vanselow wrote:
> Dear r-helpers!
> Jan Thiele asked r-help-list in february, but I could not find an answer to his question. I have the same problem:
> 
> While preparing figures of 'envfit' plots with vegan for publication, I ran into a layout problem, that I found no solution for in the literature or the help archive:
> 
> The labels of the vectors that indicate correlations of environental variables sometimes overlap with each other or with other content of the figure. Hence, I would like to rearrange them.
> 
> Is there a possibility to specify where the vector labels are plotted or, alternatively, is it possible to plot vectors only, so that the labels can be placed with 'text' later?
> 
> Thank you for any hints on how to overcome this layout problem.
> 
> 
> Thanks
> Kim

I'm sure that Jari will have a better solution, but a quick look
at plot.envfit() in pkg:vegan indicates three possibilities:

1. use cex=0.7 (e.g.) to reduce the size of the printed labels.
2. rename your variables to short one- or two-letter names.
3. comment out the following line in plot.envfit()

     text(vtext, rownames(x$vectors$arrows), col = col, ...)

Of course you will have to know which arrow represents what
when you place your text on the plot. For placing the text,
I would use

  text(locator(1), "your_label", cex=your_preferred_label_size)

I only tested this with the varechem example in ?envfit.

  -Peter Ehlers




More information about the R-help mailing list