layer_spatial.bbox: Add a bounding box to a map

View source: R/layer-spatial-bbox.R

layer_spatial.bboxR Documentation

Add a bounding box to a map

Description

To include a bounding box without drawing it, use shadow_spatial() on the original object.

Usage

## S3 method for class 'bbox'
layer_spatial(data, mapping = aes(), ..., detail = 30)

## S3 method for class 'bbox'
annotation_spatial(data, mapping = aes(), ..., detail = 30)

## S3 method for class 'bbox'
shadow_spatial(data, ..., detail = 30)

Arguments

data

A bounding box generated by sf::st_bbox()

mapping

A mapping, created using aes.

...

Passed to geom_sf

detail

Passed to sf::st_segmentize(): the number of line segments per quadrant of the bounding box. Increase this number for a smoother projected bounding box.

Examples


library(ggplot2)
load_longlake_data(which = c("longlake_waterdf", "longlake_depthdf"))
ggplot() +
  layer_spatial(sf::st_bbox(longlake_waterdf)) +
  layer_spatial(longlake_depthdf)

# use shadow_spatial() to include the geographic area of an object
# without drawing it
ggplot() +
  shadow_spatial(longlake_waterdf) +
  layer_spatial(longlake_depthdf)



ggspatial documentation built on Aug. 17, 2023, 5:13 p.m.