static_map | R Documentation |
Produce a static map of establishment likelihood, with OpenStreetMap base layer.
static_map( ras, xlim, ylim, subset_layers, layer_names, legend_title, set_value_range, scale_type = "none", basemap_mode = c("osm", "boundaries"), transparency = 0.7, colramp_entire_range = TRUE, surveillance_locs, shape = 21, pt_col = "red", aggregate_raster, nrow, height, outfile )
ras |
A |
xlim |
Numeric vector. The longitudinal extent of the area to plot, in WGS84 coordinates. |
ylim |
Numeric vector. The latitudinal extent of the area to plot, in WGS84 coordinates. |
subset_layers |
Vector. A vector of layer names or numeric positions to be included in plot. Only relevant if loading
a |
layer_names |
Character vector. A vector of panel titles (only relevant if ras is a stack). If not
provided, names from ras will be used. If provided, length must equal |
legend_title |
Character. Legend title. |
set_value_range |
A numeric vector containing an upper and lower bound value (in units of raster). Values outside this range (including values falling on the boundaries) will be masked. |
scale_type |
Character. One of:
|
basemap_mode |
Either |
transparency |
Numeric. Transparency of raster, between 0-1. |
colramp_entire_range |
Logical. Whether to set colour ramp limits based
on national risk range ( |
surveillance_locs |
A spatial object or a path to a .csv file containing columns named "Latitude" and "Longitude". |
shape |
shape(s) to use for surveillance locations. Default is 21. If you have multiple bands, and you'd like to use different symbols on each panel, specify a vector of shapes. (e.g. c(NA, 21,21,21) will not include shapes on the first panel, but will on the rest |
pt_col |
Character. The plotting colour for surveillance points. |
aggregate_raster |
|
nrow |
For multipanel plots, an optional numeric value defining the number of rows of panels. |
height |
height of plot in inches (will be rendered at 300 dpi). If not defined will use size of current graphic device. Width will be determined automatically, based on the aspect ratio given by the plotting extent. |
outfile |
Character. File path to save map. |
This function relies on the OpenStreetMap
package to obtain
base layer tiles. This in turn requires Java to be installed, and linking
R with Java can sometimes prove challenging. On macOS, Java errors can
often be resolved by entering sudo R CMD javareconf
in a terminal (
which updates R's Java configuration variables). On Windows, ensure that
the Java architecture (32-bit/64-bit) matches that of R. Additionally,
some Java errors arise when using RStudio but not when using R.
If outfile
is provided, a map is saved to that file.
Otherwise, a tmap
object is returned to R.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.