lims_bbox: Limits for 'sf'

View source: R/lims.R

lims_bboxR Documentation

Limits for 'sf'

Description

Set scale limits based on the 'bbox' of 'sf' object.

Usage

lims_bbox(x)

Arguments

x

An object of sf.

Examples

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
points_sfg <- sf::st_multipoint(as.matrix(expand.grid(x = -90:-70, y = 30:40)))
points_sfc <- sf::st_sfc(points_sfg, crs = sf::st_crs(nc))

p <- ggplot() +
  geom_sf(data = nc, aes(fill = AREA)) +
  geom_sf(data = points_sfc)

# too wide
p

# shrink the limits to the bbox of nc
p + lims_bbox(nc)


yutannihilation/ggsflabel documentation built on Feb. 8, 2023, 12:15 a.m.