AddInsetMap | R Documentation |
Add an inset map to a plot.
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 )
p |
'SpatialPolygons'. Polygon describing the large map. |
col |
'character' vector of length 2.
Colors for filling the large map polygon |
main.label |
'list'.
List with components |
sub.label |
'list'.
Identical to the |
loc |
'character' string.
Position of the inset map in the main plot region;
see |
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 |
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. |
Invisible NULL
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
PlotMap
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.