| expand_bbox | R Documentation | 
A function to take a bounding box (generated using st_bbox) and expand it by x meters in the X direction and y meters in the Y direction.
expand_bbox(bbox, X, Y, X2 = X, Y2 = Y, crs_out = 4326)
| bbox | a bounding box generated by sf::st_bbox() or named numeric vector with xmin, ymin, xmax, ymax. | 
| X | the distance in metres that we want to expand the bounding box by in the X direction | 
| Y | the distance in metres that we want to expand the bounding box by in the Y direction | 
| X2 | if specified, the meters in the Easterly direction and metresX becomes metres in the Westerly direction. | 
| Y2 | if specified, the metres to the South. metresY becomes metres to the North. | 
| crs_out | what epsg coordinate system to return the bbox in. Defaults to lat/lng (4326). | 
a named numeric vector of bbox extents. This can be converted into an sf object using sf::st_as_sfc(). Coordinates are in lat/lng (4326).
library(sf)
camden <- dplyr::filter(localauth_data, Name == "Camden") %>%
  st_transform(4326)
bbox <- expand_bbox(st_bbox(camden), 5000, 5000)
library(ggplot2)
ggplot() +
  base_map(bbox, increase_zoom = 2) +
  geom_sf(data = camden, fill = NA) +
  coord_sf(
    xlim = c(bbox["xmin"], bbox["xmax"]),
    ylim = c(bbox["ymin"], bbox["ymax"]), crs = 4326
  )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.