res_custom_sk_map {SWMPrExtension} | R Documentation |
Local Reserve Map With Seasonal Kendall Results for Custom Stations
Description
Create a stylized reserve-level map of seasonal kendall results from custom station locations for use with the reserve level reporting template
Usage
res_custom_sk_map(
stations,
x_loc,
y_loc,
sk_result = NULL,
bbox,
shp,
station_labs = TRUE,
lab_loc = NULL,
bg_map = NULL,
zoom = NULL,
maptype = "stamen_toner_lite"
)
Arguments
stations |
chr string of the reserve stations to include in the map |
x_loc |
num vector of x coordinates for |
y_loc |
num vector of y coordinates for |
sk_result |
vector of values denoting direction and significance of seasonal kendall results. Result should be c('inc', 'dec', 'insig') for sig. negative, no sig. results, and sig. positive result |
bbox |
a bounding box associated with the reserve. Must be in the format of c(X1, Y1, X2, Y2) |
shp |
sf data frame (preferred) or SpatialPolygons object |
station_labs |
logical, should stations be labeled? Defaults to
|
lab_loc |
chr vector of 'R' and 'L', one letter for each station. if no
|
bg_map |
a georeferenced |
zoom |
Zoom level for the base map created when |
maptype |
Background map type from Stadia Maps (formerly Stamen) (https://docs.stadiamaps.com/); one of c("stamen_terrain", "stamen_toner", "stamen_toner_lite", "stamen_watercolor", "alidade_smooth", "alidade_smooth_dark", "outdoors", "stamen_terrain_background", "stamen_toner_background", "stamen_terrain_labels", "stamen_terrain_lines", "stamen_toner_labels", "stamen_toner_lines"). |
Details
Creates a stylized, reserve-level base map for displaying seasonal
kendall results from sk_seasonal
. The user can specify the
reserve and stations to plot. The user can also specify a bounding box. For
multi-component reserves, the user should specify a bounding box that
highlights the component of interest.
To display seasonal trends, the user must specify c('inc', 'dec',
'insig', 'insuff')
for each station listed in the stations
argument.
Value
returns a ggplot
object
Author(s)
Julie Padilla, Dave Eslinger
Examples
### set plotting parameters
stns <- c('Stn 1', 'Stn 2')
x_coords <- c(-121.735281, -121.750369)
y_coords <- c(36.850377, 36.806667)
shp_fl <- elk_spatial
bounding_elk <- c(-121.8005, 36.7779, -121.6966, 36.8799)
lab_dir <- c('R', 'L')
trnds <- c('inc', 'dec')
### Low zoom and default maptype plot (for CRAN testing, not recommended)
# Lower zoom number gives coarser text and fewer features
(x_low <- res_custom_sk_map(stations = stns, x_loc = x_coords,
sk_result = trnds, y_loc = y_coords,
bbox = bounding_elk, lab_loc = lab_dir,
shp = shp_fl, zoom = 10))
### Default zoom and maptype plot
x_def <- res_custom_sk_map(stations = stns, x_loc = x_coords,
sk_result = trnds, y_loc = y_coords,
bbox = bounding_elk, lab_loc = lab_dir,
shp = shp_fl)
### Higher zoom number gives more details, but may not be visible
x_14 <- res_custom_sk_map(stations = stns, x_loc = x_coords,
sk_result = trnds, y_loc = y_coords,
bbox = bounding_elk, lab_loc = lab_dir,
shp = shp_fl, zoom = 14)
### Different maptypes may be used. All may not be available.
# Note that zoom and maptype interact, so some experimentation may be
# required.
x_terrain <- res_custom_sk_map(stations = stns, x_loc = x_coords,
sk_result = trnds, y_loc = y_coords,
bbox = bounding_elk, lab_loc = lab_dir,
shp = shp_fl, maptype = 'stamen_terrain')