Create a layer showing a location and related context
Source:R/layer_location_context.R
layer_location_context.Rd
Create a ggplot2 layer for a location in a provided context. This function is useful for making inset locator maps in combination with the make_inset_map function.
Arguments
- data, location
A data and location can be a either
sf
object or a ggplot layer. Either data or location is required and, if data and location are both provided, location is ignored. If data isNULL
and location is a formula or function, the context data is passed to the location function and the results used as the data for the location layer.- fill, color
Fill and color fixed aesthetics for location data.
- context
A
sf
object for context area or a ggplot layer representing the context.- context_params
A list with parameters for context layer; defaults to
list(fill = "white", color = "black", alpha = 1, ...)
.- crs
Coordinate reference system to return.
- mid_layer
A ggplot2 layer to insert between the context layer and the location layer. Optional.
- neatline
A logical object,
CoordSf
object, or a list containing aCoordSf
object (typically fromlayer_neatline()
) added to layer.If logical and
TRUE
, add a neatline layer using data from the context layer withcolor = NA
andbgcolor = "none"
.If object from
layer_neatline()
, add it as is.
- basemap
Either a logical vector or ggplot object.
If logical and
TRUE
, add x toggplot2::ggplot()
. IfFALSE
, return x as is.If a ggplot, add x to basemap object.
If a ggproto object (or list that contains a ggproto object), add x and basemap object to
ggplot2::ggplot()
.- ...
Additional parameters passed to
layer_location_data()
if data or location is ansf
object.