Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gt_locate

Locate (and identify) clicks


Description

Click into a plot to get the location or identify values

Usage

gt_locate(
  samples = 1,
  panel = NULL,
  identify = FALSE,
  snap = FALSE,
  raw = FALSE,
  show = TRUE,
  ...
)

Arguments

samples

[integerish(1)]
the number of clicks.

panel

[character(1)]
the panel in which to locate (i.e. the title shown over the plot).

identify

[logical(1)]
get the raster value or geom ID at the sampled location (TRUE) or merely the location (FALSE, default).

snap

[logical(1)]
should the returned value(s) be set to the nearest raster cell's center (TRUE) or should they remain the selected, "real" value (FALSE, default)?

raw

[logical(1)]
should the complete statistics about the clicks be returned (TRUE), or should only the basic output be returned (FALSE, default)?

show

[logical(1)]
should information be plotted (TRUE), or should they merely be returned to the console (FALSE, default)?

...

[various]
graphical parameters of the objects that are created when show = TRUE.

Value

A tibble of the selected locations and, if identify = TRUE, the respective values. If show = TRUE the values are also shown in the plot.

See Also

Other geometry tools: gt_filter(), gt_pull(), gt_reflect(), gt_rotate(), gt_scale(), gt_skew(), gt_stretch(), gt_translate()

Examples

if(dev.interactive()){

  # locate coordinates with geoms
  visualise(geom = gtGeoms$polygon)
  gt_locate(samples = 2)

  # locate or identify values with rasters
  visualise(raster = gtRasters$continuous)
  gt_locate(identify = TRUE, snap = TRUE)

  # with several panels, specify a target
  visualise(gtRasters)
  gt_locate(samples = 4, panel = "categorical",
            snap = TRUE, identify = TRUE)

}

geometr

Generate and Modify Interoperable Geometric Shapes

v0.2.10
GPL-3
Authors
Steffen Ehrmann [aut, cre] (<https://orcid.org/0000-0002-2958-0796>), Dan Sunday [cph] (fast point-in-polygon algorithm.)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.