plot.map | R Documentation |
map
objectThis function plot a GeoPressureR map
object.
You can plot on top of the map
a path
, this uses the plot_path()
function.
Our maps are defined in lat-lon (i.e., EPSG:4326), but the display of maps on web map are
nearly always in web mercator (i.e.,
EPSG:3857). We therefore need to reproject our map for display.
However, we don't really want to interpolate the map as each pixel might be important to
visualize. We therefore re-project with a near-neighbour interpolation (method = "near"
in terra::project()
). Yet to avoid having pixel misplaced, we generally need to use a
projection with a finer resolution. The argument fac_res_proj
controls the relative change of
resolution between the original map to the projected map.
## S3 method for class 'map'
plot(
x,
path = NULL,
thr_likelihood = 1,
plot_leaflet = TRUE,
provider = "Esri.WorldTopoMap",
provider_options = leaflet::providerTileOptions(),
palette = "auto",
opacity = 0.8,
legend = FALSE,
fac_res_proj = 4,
...
)
x |
a |
path |
a GeoPressureR |
thr_likelihood |
threshold of percentile (see details). |
plot_leaflet |
logical to use an interactive |
provider |
the name of the provider (see https://leaflet-extras.github.io/leaflet-providers/preview/ and https://github.com/leaflet-extras/leaflet-providers) |
provider_options |
tile options. See leaflet::addProviderTiles() and leaflet::providerTileOptions() |
palette |
The colors or color function that values will be mapped to |
opacity |
the base opacity of the raster, expressed from 0 to 1 |
legend |
logical or character. If not |
fac_res_proj |
Factor of the resolution of the reprojection (see details above). A value of
|
... |
named parameters to add to the options |
map |
a GeoPressureR |
a plot or leaflet object.
plot_path()
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |>
tag_label(quiet = TRUE) |>
tag_set_map(
extent = c(-16, 23, 0, 50),
scale = 4
) |>
geopressure_map(quiet = TRUE)
})
plot(tag$map_pressure)
plot(tag$map_pressure, plot_leaflet = FALSE)
# `thr_likelihood` can be used to visualize its effect in `graph_create`
plot(tag$map_pressure,
thr_likelihood = 0.9,
palette = "viridis",
opacity = 1,
provider = "CartoDB.DarkMatterNoLabels"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.