Skip to content
Prev 278428 / 398513 Next

Vegan: how to plot sites labes in diversity plot

On Nov 24, 2011, at 8:12 AM, Alejo C.S. wrote:

            
Right. Generally you cannot just make up argument names and expect  
plotting routines to honor them. There is no "labels" argument in  
`plot.default` either.

class(mod)   # to figure out what vegan thinks it object is named
[1] "taxondive"
 > methods(plot)  # to make sure there is a specific plot method
 > vegan:::plot.taxondive  # triple dots because it is hidden
function (x, ...)
{
     plot(x$Species, x$Dplus, xlab = "Number of Species", ylab =  
expression(Delta^"+"),
         ...)
     i <- order(x$Species)
     abline(h = x$EDplus, ...)
     lines(x$Species[i], x$EDplus - 2 * x$sd.Dplus[i], ...)
     lines(x$Species[i], x$EDplus + 2 * x$sd.Dplus[i], ...)
}
<environment: namespace:vegan>

So from that above you see that the plotting routine is doing nothing  
special. Just plotting x,y values and a bit of annotation

So to plot "labels" offset a bit to the left and down you look at the  
scale of the plot dimension and take a guess at what will collide th  
least. There are also tricky routines in packages plotrix and Hmisc  
that will do the placement for you, but you clearly need to start  
learning basic R first.

  with( mod, text(Species-.3, Dplus-1, as.character(1:length(Dplus)))  )