Create and store an inset configuration used by with_inset(). The
configuration contains subplot specifications, aspect ratio of the main plot,
CRS settings, and border appearance for insets.
Arguments
- specs
A non-empty list of
inset_spec()objects.- to_crs
Coordinate reference system to transform to, passed to
ggplot2::coord_sf()ascrs. Default"EPSG:4326".- from_crs
Coordinate reference system of bboxes in
specs. Default"EPSG:4326".- bbox
An optional bounding box (compatible with
sf::st_bbox()) to define the default extent for subplots that do not specify their own coordinates. If NULL, subplots must specify their own valid dimensions/coordinates.- lims_method
Method to calculate limits from bbox. See also
ggplot2::coord_sf(). Default"cross".- border_args
A list of named arguments passed to
map_border()to style the borders around inset plots. Seemap_border()for details (defaults:color = "black",linewidth = 1).
Value
An object of class insetcfg. Also stored as the last configuration, retrievable via last_insetcfg().
Examples
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
config_insetmap(
bbox = sf::st_bbox(nc),
specs = list(
inset_spec(main = TRUE),
inset_spec(
xmin = -84, xmax = -75, ymin = 33, ymax = 37,
loc = "left bottom", scale_factor = 0.5
)
)
)