Learn R Programming

ggmap (version 2.2)

gglocator: Locator for ggplots.

Description

Locator for ggplots.

Usage

gglocator(n = 1, object = last_plot(), message = FALSE,
    xexpand = c(0.05, 0), yexpand = c(0.05, 0))

Arguments

n
number of points to locate.
object
plot to locate on
message
turn messaging from grid.ls on/off
xexpand
expand argument in scale_x_continuous
yexpand
expand argument in scale_y_continuous

Value

  • a data frame with columns according to the x and y aesthetics

Examples

Run this code
df <- data.frame(xvar = 1:10, yvar = 1:10)
qplot(xvar, yvar, data = df) + annotate(geom = 'point', x = 3, y = 6)
gglocator(4)

qplot(xvar, yvar, data = df) +
  scale_x_continuous(expand = c(0,0)) +
  scale_y_continuous(expand = c(0,0))
gglocator(1, xexpand = c(0,0), yexpand = c(0,0))

Run the code above in your browser using DataLab