mvlabs: Move Text Labels Interactively

Description Usage Arguments Value See Also Examples

View source: R/plots.R

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

1
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

1
2
3
4
5
  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)

caroline documentation built on May 1, 2019, 9:19 p.m.

Related to mvlabs in caroline...