R: Move Text Labels Interactively

mvlabs {caroline} | R Documentation

## Move Text Labels Interactively

### Description

There is no easy way to move point labels around interactively on an a plot in R. This function allows a point and click way to select (using identify) and move (using locator) points by modifying the underlying dataframe.

### Usage

    mvlabs(df, n=nrow(df), x='x', y='y', l='lab', cols=colors()[grep("dark",colors())], ...)

### Arguments

`df` | A dataframe with x and y coordinates and text labels
`n` | the number of points you wish to move
`x` | the column name of the x axis coordinates
`y` | the column name of the y axis coordinates
`l` | the column name of the point labels
`cols` | the color vector to iterate through while assigning new positions.
`...` | other paramters passed on to text

### Value

a series of violin plots

### See Also

locator,identify,labsegs

### Examples

      x <- rnorm(20); y <- rnorm(20)
      df <- data.frame(x,y, lab=as.character(letters[1:20]))
      plot(df$x, df$y, pch=''); text(df$x, df$y, df$lab)
      ## df <- mvlabs(df, 'x','y','lab', n=3)
      plot(df$x, df$y, pch=''); text(df$x, df$y, df$lab)

[Package caroline version 0.7.6 Index]