Learn R Programming

insetplot (version 1.4.0)

config_insetmap: Configure inset map settings

Description

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.

Usage

config_insetmap(
  specs,
  to_crs = sf::st_crs("EPSG:4326"),
  from_crs = sf::st_crs("EPSG:4326"),
  bbox = NULL,
  lims_method = "cross",
  border_args = list()
)

Value

An object of class insetcfg. Also stored as the last configuration, retrievable via last_insetcfg().

Arguments

specs

A non-empty list of inset_spec() objects.

to_crs

Coordinate reference system to transform to, passed to ggplot2::coord_sf() as crs. 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. See map_border() for details (defaults: color = "black", linewidth = 1).

See Also

inset_spec(), with_inset(), last_insetcfg()

Examples

Run this code
library(sf)

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
        )
    )
)

Run the code above in your browser using DataLab