Skip to content

overlapping labels

5 messages · Biscarini, Filippo, jim holtman, Duncan Murdoch +2 more

#
You might look at 'jitter' to add a little offset to the labels being plotted.
On Dec 3, 2007 9:21 AM, Biscarini, Filippo <Filippo.Biscarini at wur.nl> wrote:

  
    
#
On 12/3/2007 12:21 PM, Biscarini, Filippo wrote:
I don't think there are any functions to automatically avoid overlaps, 
but it is not hard to manually move some of the labels.  For example, 
you could alternate labels above and below with code like this:

 > x <- 1:10
 > y <- rep(0, 10)
 > plot(x,y)
 > text(x, y, rep("label", 10), pos=rep(c(1,3), 5))

because the pos parameter can be specified separately for each observation.

Duncan Murdoch
#
Duncan Murdoch wrote:
The OP might like to take a look at the orditorp function in package 
vegan, which is designed to add information from complex ecological 
data sets with many species to ordinations. It works out if a label 
can be placed and if not draws a point. The OP would have to modify it 
to try another place to plot, but that might be a basis from which to 
work.

Of course, if this is a one-off project Duncan's solution is more than 
adequate.

G

For example,

  
    
#
Biscarini, Filippo wrote:
Hi Filippo,
Have a look at thigmophobe.labels in the plotrix package.

Jim