View source: R/set_map_limits.R
set_map_limits | R Documentation |
This function is deprecated because the functionality has been incorporated
into the improved maplayer::layer_neatline()
function which uses a similar
set of parameters.
Set limits for a map to the bounding box of an area using coord_sf()
.
Optionally, adjust the area size by applying a buffer and/or adjust the
aspect ratio of the limiting bounding box to match a set aspect ratio.
set_map_limits(
area = NULL,
bbox = NULL,
dist = NULL,
diag_ratio = NULL,
asp = NULL,
crs = pkgconfig::get_config("mapbaltimore.crs", 2804),
expand = FALSE,
...
)
area |
|
bbox |
|
dist |
buffer distance in meters. Optional. |
diag_ratio |
ratio to set map extent based diagonal distance of area's
bounding box. Ignored when |
asp |
Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). |
crs |
Coordinate reference system to use for |
expand |
Default FALSE. If TRUE, use scale_y_continuous and scale_x_continuous to expand map extent to provided parameters. |
... |
Additional parameters to pass to |
Set map limits to area with optional buffer or aspect ratio adjustment
ggplot2::coord_sf()
function with xlim and ylim parameters
# Show detailed city boundary with map focused on area of Fell's Point (with 50m buffer)
library(ggplot2)
ggplot() +
geom_sf(data = baltimore_city_detailed) +
set_map_limits(area = get_area("neighborhood", "Fells Point"), dist = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.