Skip to contents

Label markers, streets, areas, or other simple feature objects using any of the following geoms: "text", "label", "textsf", "labelsf", "text_repel", or "label_repel". This function is experimental and may be adopted into the overedge package in the future.

Usage

layer_show_label(
  data,
  location = NULL,
  geom = "text",
  fn = NULL,
  label_col = NULL,
  mapping = NULL,
  union = FALSE,
  clip = NULL,
  dist = NULL,
  unit = NULL,
  ...
)

Arguments

data

Data to use for label creation

location

Location to label (if not specified the data is assumed to conver the whole location);

geom

A geom to use "text", "label", "textsf", "labelsf", "text_repel", or "label_repel"

fn

Function to apply to data before creating labels; can be used in the creation of the label_col

label_col

Label column name

mapping

Aesthetic mapping, Default: NULL

union

If TRUE, group by label_col and union geometry, Default: FALSE

clip

Character string describing the part of the area to clip or remove. Options include c("top", "right", "bottom", "left", "topright", "bottomright", "bottomleft", "topleft"). If NULL, the area is not clipped and a full edge can be returned.

dist

Numeric. Distance to use for the edge. Default NULL meters. Use negative values for an inside edge or positive numbers for an outside edge.

unit

Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"

...

Additional parameters passed to overedge::layer_location_data

Details

Note:

  • Unlike in some overedge package functions, fn is applied to the whole data; not a subset of the data based on location.

  • For this function, dist and unit are both used by overedge::st_clip() (not by layer_location_data)

The function also overrides the label aesthetics to hide the colored letters that would otherwise appear when using a theme legend.