lims_bbox.Rd
Set scale limits based on the 'bbox' of 'sf' object.
lims_bbox(x)
x | An object of |
---|
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)