AddInsetMap: Add Inset Map to Plot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/AddInsetMap.R

Description

Add an inset map to a plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
AddInsetMap(
  p,
  col = c("#D8D8D8", "#BFA76F"),
  main.label = list(label = NA, adj = NULL),
  sub.label = list(label = NA, adj = NULL),
  loc = "topright",
  inset = 0.02,
  width = NULL,
  e = graphics::par("usr"),
  bty = c("o", "n"),
  feature = NULL
)

Arguments

p

'SpatialPolygons'. Polygon describing the large map.

col

'character' vector of length 2. Colors for filling the large map polygon p and the smaller plot extent rectangle.

main.label

'list'. List with components label and adj. The text label and position (x and y adjustment of the label) for the large map, respectively.

sub.label

'list'. Identical to the main.label argument but for the plot extent rectangle.

loc

'character' string. Position of the inset map in the main plot region; see GetInsetLocation function for keyword descriptions.

inset

'numeric' vector of length 1 or 2, value is recycled as necessary. Inset distance(s) from the margins as a fraction of the main plot region. Defaults to 2 percent of the axis range.

width

'numeric' number. Width of the inset map in inches.

e

'numeric' vector of length 4. Extent of the smaller axis-aligned rectangle (relative to the larger map polygon). Defaults to the user coordinate extent of the main plot region.

bty

'character' string. Type of box to be drawn about the inset map. A value of "o" (the default) results in a box and a value of "n" suppresses the box.

feature

'list'. One or more spatial objects, along with style arguments, to add to the inset map. Each list element is a 'list'-class object that contains the following components: the first component is the name of the plotting function; the second component is the object to be plotted; and the remaining components are reserved for arguments to be passed to the function.

Value

Invisible NULL

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

See Also

PlotMap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
file <- system.file("extdata/county.geojson",
                    package = "inlmisc")[1]
county <- rgdal::readOGR(file)
ext <- c(-113.4005, -112.2764, 43.30, 44.11)
PlotMap(county, xlim = ext[1:2], ylim = ext[3:4],
        dms.tick = TRUE)
sp::plot(county, add = TRUE)
AddInsetMap(county, width = 2,
            main.label = list("IDAHO", "adj" = c(0, -10)),
            sub.label = list("Map area", "adj" = c(0, -4)),
            loc = "topright")

inlmisc documentation built on Jan. 25, 2022, 1:14 a.m.