Learn R Programming

caroline (version 0.9.9)

mvlabs: 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())], ...)

Value

a series of violin plots

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

See Also

Examples

Run this code
  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)

Run the code above in your browser using DataLab