| Title: | Create Maps of Air Pollution Data |
|---|---|
| Description: | Combine the air quality data analysis methods of 'openair' with the JavaScript 'Leaflet' (<https://leafletjs.com/>) library. Functionality includes plotting site maps, "directional analysis" figures such as polar plots, and air mass trajectories. |
| Authors: | Jack Davison [cre, aut] (ORCID: <https://orcid.org/0000-0003-2653-6615>), David Carslaw [aut] (ORCID: <https://orcid.org/0000-0003-0991-950X>) |
| Maintainer: | Jack Davison <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.10.1.9000 |
| Built: | 2026-06-03 13:19:23 UTC |
| Source: | https://github.com/openair-project/openairmaps |
This function is similar (but not identical to) the leaflet::addMarkers()
and leaflet::addCircleMarkers() functions in leaflet, which allows users
to add openair directional analysis plots to any leaflet map and have more
control over groups and layerIds than in "all-in-one" functions like
polarMap().
addPolarMarkers( map, pollutant, fun = openair::polarPlot, lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, key.position = "none", d.icon = 200, d.fig = 3.5, alpha = 1, data = leaflet::getMapData(map), ... ) addPolarDiffMarkers( map, pollutant, before = leaflet::getMapData(map), after = leaflet::getMapData(map), lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, key.position = "none", d.icon = 200, d.fig = 3.5, alpha = 1, ... )addPolarMarkers( map, pollutant, fun = openair::polarPlot, lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, key.position = "none", d.icon = 200, d.fig = 3.5, alpha = 1, data = leaflet::getMapData(map), ... ) addPolarDiffMarkers( map, pollutant, before = leaflet::getMapData(map), after = leaflet::getMapData(map), lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, key.position = "none", d.icon = 200, d.fig = 3.5, alpha = 1, ... )
map |
a map widget object created from |
pollutant |
The name of the pollutant to be plot. Note that, if |
fun |
An |
lng |
The decimal longitude. |
lat |
The decimal latitude. |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
popup |
A column of |
popupOptions |
A Vector of |
label |
A column of |
labelOptions |
A Vector of |
options |
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements |
clusterOptions |
if not |
clusterId |
the id for the marker cluster layer |
key.position |
Passed to |
d.icon |
The diameter of the plot on the map in pixels. This will affect
the size of the individual polar markers. Alternatively, a vector in the
form |
d.fig |
The diameter of the plots to be produced using |
alpha |
The desired opacity of the polar markers. Can also be set via
|
data |
A data frame. The data frame must contain the data to plot your
choice of openair directional analysis plot, which includes wind speed
( |
... |
Other arguments for the plotting function (e.g. |
before, after
|
A data frame that represents the before/after case. See
|
A leaflet object.
addPolarMarkers(): Add any one-table polar marker (e.g.,
openair::polarPlot())
addPolarDiffMarkers(): Add the two-table openair::polarDiff() marker.
shiny::runExample(package = "openairmaps") to see examples of this
function used in a shiny::shinyApp()
## Not run: library(leaflet) library(openair) # different types of polar plot on one map leaflet(data = polar_data) |> addTiles() |> addPolarMarkers( "ws", fun = openair::windRose, annotate = FALSE, group = "Wind Rose" ) |> addPolarMarkers("nox", fun = openair::polarPlot, group = "Polar Plot") |> addLayersControl( baseGroups = c("Wind Rose", "Polar Plot") ) # use of polar diff (NB: both 'before' and 'after' inherit from `leaflet()`, # so at least one should be overridden - in this case 'after') leaflet(data = polar_data) |> addTiles() |> addPolarDiffMarkers("nox", after = dplyr::mutate(polar_data, nox = jitter(nox, 5)) ) ## End(Not run)## Not run: library(leaflet) library(openair) # different types of polar plot on one map leaflet(data = polar_data) |> addTiles() |> addPolarMarkers( "ws", fun = openair::windRose, annotate = FALSE, group = "Wind Rose" ) |> addPolarMarkers("nox", fun = openair::polarPlot, group = "Polar Plot") |> addLayersControl( baseGroups = c("Wind Rose", "Polar Plot") ) # use of polar diff (NB: both 'before' and 'after' inherit from `leaflet()`, # so at least one should be overridden - in this case 'after') leaflet(data = polar_data) |> addTiles() |> addPolarDiffMarkers("nox", after = dplyr::mutate(polar_data, nox = jitter(nox, 5)) ) ## End(Not run)
This function is similar (but not identical to) the leaflet::addMarkers()
function in leaflet, which allows users to add trajectory paths to any
leaflet map and have more control over groups and layerIds than in
"all-in-one" functions like trajMap().
addTrajPaths( map, lng = "lon", lat = "lat", layerId = NULL, group = NULL, data = leaflet::getMapData(map), npoints = 12, ... )addTrajPaths( map, lng = "lon", lat = "lat", layerId = NULL, group = NULL, data = leaflet::getMapData(map), npoints = 12, ... )
map |
a map widget object created from |
lng |
The decimal longitude. |
lat |
The decimal latitude. |
layerId |
The base string for the layer id. The actual layer IDs will be in the format "layerId-linenum" for lines and "layerId_linenum-pointnum" for points. For example, the first point of the first trajectory path will be "layerId-1-1". |
group |
the name of the group the newly created layers should belong to
(for |
data |
Data frame, the result of importing a trajectory file using
|
npoints |
A dot is placed every |
... |
Other arguments to pass to both |
addTrajPaths() can be a powerful way of quickly plotting
trajectories on a leaflet map, but users should take some care due to any
additional arguments being passed to both leaflet::addCircleMarkers() and
leaflet::addPolylines(). In particular, users should be weary of the use
of the color argument. Specifically, if color is passed a vector of
length greater than one, multiple polylines will be drawn on top of one
another. At best this will affect opacity, but at worst this will
significantly impact the performance of R and the final leaflet map.
To mitigate this, please ensure that any vector passed to color is of
length one. This is simple if you want the whole path to be the same
colour, but more difficult if you want to colour by a pollutant, for
example. The easiest way to achieve this is to write a for loop or use
another iterative approach (e.g. the purrr package) to add one path per
arrival date. An example of this is provided in the Examples.
A leaflet object.
shiny::runExample(package = "openairmaps") to see examples of this
function used in a shiny::shinyApp()
## Not run: library(leaflet) library(openairmaps) pal <- colorNumeric(palette = "viridis", domain = traj_data$nox) map <- leaflet() |> addTiles() for (i in seq_along(unique(traj_data$date))) { data <- dplyr::filter(traj_data, date == unique(traj_data$date)[i]) map <- map |> addTrajPaths( data = data, color = pal(data$nox)[1] ) } map ## End(Not run)## Not run: library(leaflet) library(openairmaps) pal <- colorNumeric(palette = "viridis", domain = traj_data$nox) map <- leaflet() |> addTiles() for (i in seq_along(unique(traj_data$date))) { data <- dplyr::filter(traj_data, date == unique(traj_data$date)[i]) map <- map |> addTrajPaths( data = data, color = pal(data$nox)[1] ) } map ## End(Not run)
The annulusMap() function creates a map using polar annulus plots as
markers. Any number of pollutants can be specified using the pollutant
argument, and multiple layers of markers can be created using type. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
annulusMap( data, pollutant = NULL, period = "hour", limits = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )annulusMap( data, pollutant = NULL, period = "hour", limits = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with pollutant, wind, and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
pollutant |
Pollutant name(s). required | scope: dynamic & static The column name(s) of the pollutant(s) to plot. If multiple pollutants are
specified and a non-pairwise statistic is supplied, the
Multiple |
period |
Temporal period for radial axis. default: Options are "hour" (the default, to plot diurnal variations), "season" to plot variation throughout the year, "weekday" to plot day of the week variation and "trend" to plot the trend by wind direction. |
limits |
Specifier for the plot colour scale bounds. default: One of:
|
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
diffMap(),
freqMap(),
percentileMap(),
polarMap(),
pollroseMap(),
windroseMap()
## Not run: annulusMap(polar_data, pollutant = "nox", period = "hour", provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: annulusMap(polar_data, pollutant = "nox", period = "hour", provider = "CartoDB.Voyager" ) ## End(Not run)
Group a dataframe together by latitude/longitude columns and create a HTML
popup with user-defined columns. By default, the unique values of character
columns are collapsed into comma-separated lists, numeric columns are
averaged, and date columns are presented as a range. This function returns
the input dataframe appended with a "popup" column, which can then be used in
the popup argument of a function like polarMap().
buildPopup( data, columns, latitude = NULL, longitude = NULL, type = NULL, fun.character = function(x) { paste(unique(x), collapse = ", ") }, fun.numeric = function(x) { signif(mean(x, na.rm = TRUE), 3) }, fun.dttm = function(x) { paste(lubridate::floor_date(range(x, na.rm = TRUE), "day"), collapse = " to ") }, ... )buildPopup( data, columns, latitude = NULL, longitude = NULL, type = NULL, fun.character = function(x) { paste(unique(x), collapse = ", ") }, fun.numeric = function(x) { signif(mean(x, na.rm = TRUE), 3) }, fun.dttm = function(x) { paste(lubridate::floor_date(range(x, na.rm = TRUE), "day"), collapse = " to ") }, ... )
data |
Input data table with geo-spatial information. required A data frame containing latitude and longitude information that will go on
to be used in a function such as |
columns |
A character vector of column names to include in the popup. required Summaries of the selected columns will appear in the popup. If a named vector is provided, the names of the vector will be used in place of the raw column names. See the Examples for more information. |
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
type |
A column to be passed to the default: Column which will be used for the |
fun.character |
A function to summarise character and factor columns. default: The default collapses unique values into a comma-separated list. |
fun.numeric |
A function to summarise numeric columns. default: The default takes the mean to three significant figures. Other numeric summaries may be of interest, such as the maximum, minimum, standard deviation, and so on. |
fun.dttm |
A function to summarise date columns. default: The default presents the date as a range. Other statistics of interest could be the start or end of the dates. |
... |
Not currently used. |
a tibble
## Not run: buildPopup( data = polar_data, columns = c( "Site" = "site", "Site Type" = "site_type", "Date Range" = "date" ) ) |> polarMap("nox", popup = "popup") ## End(Not run)## Not run: buildPopup( data = polar_data, columns = c( "Site" = "site", "Site Type" = "site_type", "Date Range" = "date" ) ) |> polarMap("nox", popup = "popup") ## End(Not run)
This is a much simpler implementation of the tools found in the
PostcodesioR R package, intended for use with the networkMap()
function.
convertPostcode(postcode)convertPostcode(postcode)
postcode |
A valid UK postcode. required A string containing a single valid UK postcode, e.g., |
A list containing the latitude, longitude, and input postcode.
The PostcodesioR package at
https://github.com/ropensci/PostcodesioR/
# convert a UK postcode convertPostcode("SW1A1AA") ## Not run: # use with `networkMap()` palace <- convertPostcode("SW1A1AA") networkMap("aurn", lat = palace$lat, lng = palace$lng, max_dist = 10) ## End(Not run)# convert a UK postcode convertPostcode("SW1A1AA") ## Not run: # use with `networkMap()` palace <- convertPostcode("SW1A1AA") networkMap("aurn", lat = palace$lat, lng = palace$lng, max_dist = 10) ## End(Not run)
The diffMap() function creates a map using bivariate polar plots as
markers. Any number of pollutants can be specified using the pollutant
argument, and multiple layers of markers can be created using type. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
diffMap( before, after, pollutant = NULL, x = "ws", limits = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = rev(openair::openColours("RdBu", 10)), alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )diffMap( before, after, pollutant = NULL, x = "ws", limits = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = rev(openair::openColours("RdBu", 10)), alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
before, after
|
Data frames representing the "before" and "after" cases.
See |
pollutant |
Mandatory. A pollutant name corresponding to a variable in a
data frame should be supplied e.g. |
x |
Name of variable to plot against wind direction in polar coordinates, the default is wind speed, “ws”. |
limits |
Limits for the plot colour scale. default: One of:
Note that the |
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
Character string(s) defining how data should be split/conditioned
before plotting.
Most |
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
freqMap(),
percentileMap(),
polarMap(),
pollroseMap(),
windroseMap()
## Not run: # NB: "after" is some dummy data to demonstrate functionality diffMap( before = polar_data, after = dplyr::mutate(polar_data, nox = jitter(nox, factor = 5)), pollutant = "nox" ) ## End(Not run)## Not run: # NB: "after" is some dummy data to demonstrate functionality diffMap( before = polar_data, after = dplyr::mutate(polar_data, nox = jitter(nox, factor = 5)), pollutant = "nox" ) ## End(Not run)
The freqMap() function creates a map using polar frequency plots as
markers. Any number of pollutants can be specified using the pollutant
argument, and multiple layers of markers can be created using type. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
freqMap( data, pollutant = NULL, statistic = "mean", breaks = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )freqMap( data, pollutant = NULL, statistic = "mean", breaks = "free", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with pollutant, wind, and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
pollutant |
Pollutant name(s). required | scope: dynamic & static The column name(s) of the pollutant(s) to plot. If multiple pollutants are
specified and a non-pairwise statistic is supplied, the
Multiple |
statistic |
The statistic that should be applied to each wind speed/direction bin. default: Can be "frequency", "mean", "median", "max" (maximum), "stdev" (standard
deviation) or "weighted.mean". The option "frequency" is the simplest and
plots the frequency of wind speed/direction in different bins. The scale
therefore shows the counts in each bin. The option "mean" (the default) will
plot the mean concentration of a pollutant (see next point) in wind
speed/direction bins, and so on. Finally, "weighted.mean" will plot the
concentration of a pollutant weighted by wind speed/direction. Each segment
therefore provides the percentage overall contribution to the total
concentration. Note that for options other than "frequency", it is necessary
to also provide the name of a pollutant. See function |
breaks |
Specifier for the breaks of the plot colour scale. default: One of:
|
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
diffMap(),
percentileMap(),
polarMap(),
pollroseMap(),
windroseMap()
## Not run: freqMap(polar_data, pollutant = "nox", statistic = "mean", provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: freqMap(polar_data, pollutant = "nox", statistic = "mean", provider = "CartoDB.Voyager" ) ## End(Not run)
These functions create interpolated surfaces out of data at individual
monitoring sites. This can be useful to 'fill in the gaps' to estimate
pollution concentrations where no monitoring is occurring, or better
identify geographical patterns in pollution data. krigingMap() creates a
smooth spatially interpolated surface using either inverse distance
weighting or point kriging. voronoiMap() creates a surface of 'closest
observation' polygons. The kriging formula is currently always pollutant ~ 1; krigingMap() does not currently support more complex models.
krigingMap( data, pollutant = NULL, statistic = "mean", percentile = 95, newdata = NULL, method = c("idw", "kriging"), breaks = NULL, labels = NULL, limits = NULL, latitude = NULL, longitude = NULL, crs = 4326, provider = "OpenStreetMap", cols = "turbo", alpha = 0.8, show.markers = TRUE, marker.border = "white", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, static = FALSE, vgm = gstat::vgm(psill = 1, model = "Exp", range = 50000, nugget = 1), args.idw = list(), args.variogram = list(), args.fit.variogram = list(), args.krige = list() ) voronoiMap( data, pollutant = NULL, statistic = "mean", percentile = 95, newdata = NULL, breaks = NULL, labels = NULL, limits = NULL, latitude = NULL, longitude = NULL, crs = 4326, provider = "OpenStreetMap", cols = "turbo", alpha = 0.8, show.markers = TRUE, marker.border = "white", voronoi.border = "white", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, static = FALSE, args.voronoi = list() )krigingMap( data, pollutant = NULL, statistic = "mean", percentile = 95, newdata = NULL, method = c("idw", "kriging"), breaks = NULL, labels = NULL, limits = NULL, latitude = NULL, longitude = NULL, crs = 4326, provider = "OpenStreetMap", cols = "turbo", alpha = 0.8, show.markers = TRUE, marker.border = "white", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, static = FALSE, vgm = gstat::vgm(psill = 1, model = "Exp", range = 50000, nugget = 1), args.idw = list(), args.variogram = list(), args.fit.variogram = list(), args.krige = list() ) voronoiMap( data, pollutant = NULL, statistic = "mean", percentile = 95, newdata = NULL, breaks = NULL, labels = NULL, limits = NULL, latitude = NULL, longitude = NULL, crs = 4326, provider = "OpenStreetMap", cols = "turbo", alpha = 0.8, show.markers = TRUE, marker.border = "white", voronoi.border = "white", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, static = FALSE, args.voronoi = list() )
data |
Input data table with pollutant and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain at least one numeric column to
interpolate, plus a decimal latitude and longitude (or X/Y coordinate used
in conjunction with |
pollutant |
Pollutant name. required | scope: dynamic & static The column name of the pollutant to plot. Multiple |
statistic |
Statistic for aggregating pollutant data. default: Pollutant data will be aggregated by latitude & longitude;
|
percentile |
The percentile when 'statistic = "percentile" default: The percentile level used when |
newdata |
A spatial dataset of prediction locations. default: By default, a bounding box of all latitudes and longitudes are used for
prediction, but this is often not useful or aesthetically pleasing.
|
method |
Spatial interpolation method. default: The spatial interpolation method to use for |
labels, breaks
|
Discretise the map color scale. default: By default, a continuous colour scale is used. If |
limits |
Specifier for the plot colour scale bounds. default: A numeric vector in the form |
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for interpolated surface. default: A value between 0 (fully transparent) and 1 (fully opaque). |
show.markers |
Show original monitoring site markers? default: When |
marker.border, voronoi.border
|
Border colour to use for markers and voronoi tiles. default: Any valid HTML colour (e.g., a hex code). Use |
legend |
Draw a legend? default: When |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
vgm |
A variogram model default: The variogram model to use when |
args.idw, args.variogram, args.fit.variogram, args.krige
|
Extra arguments
to pass to spatial interpolation functions for scope: dynamic & static Extra arguments passed to |
args.voronoi |
Extra arguments to pass to spatial interpolation
functions for scope: dynamic & static Extra arguments passed to |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
## Not run: # import ozone DAQI daqi <- openair::importUKAQ( pollutant = "o3", year = 2020, source = "aurn", data_type = "daqi", meta = TRUE ) # get a UK shapefile uk <- rnaturalearth::ne_countries(scale = 10, country = "united kingdom") # create spatially interpolated map voronoiMap( daqi, pollutant = "poll_index", newdata = uk, statistic = "max", breaks = seq(0.5, 10.5, 1), labels = as.character(1:10), legend.title = "Max O3 DAQI", cols = "daqi" ) krigingMap( daqi, pollutant = "poll_index", newdata = uk, statistic = "max", legend.title = "Max O3 DAQI", cols = openair::openColours("daqi", n = 10), limits = c(1, 10) ) ## End(Not run)## Not run: # import ozone DAQI daqi <- openair::importUKAQ( pollutant = "o3", year = 2020, source = "aurn", data_type = "daqi", meta = TRUE ) # get a UK shapefile uk <- rnaturalearth::ne_countries(scale = 10, country = "united kingdom") # create spatially interpolated map voronoiMap( daqi, pollutant = "poll_index", newdata = uk, statistic = "max", breaks = seq(0.5, 10.5, 1), labels = as.character(1:10), legend.title = "Max O3 DAQI", cols = "daqi" ) krigingMap( daqi, pollutant = "poll_index", newdata = uk, statistic = "max", legend.title = "Max O3 DAQI", cols = openair::openColours("daqi", n = 10), limits = c(1, 10) ) ## End(Not run)
This function uses openair::importMeta() to obtain metadata for measurement
sites and uses it to create an interactive leaflet map. By default a map
will be created in which readers may toggle between a vector base map and a
satellite/aerial image, although users can further customise the control menu
using the provider and control parameters. Any argument which can be
passed to openair::importMeta() can be passed via ..., with the exception
of all and duplicate.
networkMap( source = "aurn", ..., control = NULL, cluster = NULL, provider = c(Default = "OpenStreetMap", Satellite = "Esri.WorldImagery"), legend = TRUE, legend.position = "topright", control.collapsed = FALSE, control.position = "topright" )networkMap( source = "aurn", ..., control = NULL, cluster = NULL, provider = c(Default = "OpenStreetMap", Satellite = "Esri.WorldImagery"), legend = TRUE, legend.position = "topright", control.collapsed = FALSE, control.position = "topright" )
source |
One or more UK or European monitoring networks. default: One or more air quality networks for which data is available through openair. Available networks include:
There are two additional options provided for convenience:
|
... |
Arguments passed on to
|
control |
Option to create a 'layer control' menu. default: A string to specify categories in a "layer control" menu, to allow readers to select between different site categories. Choices include:
|
cluster |
Cluster markers together when zoomed out? default: When |
provider |
The basemap(s) to be used. default: Any number of leaflet::providers. See
http://leaflet-extras.github.io/leaflet-providers/preview/ for a list of
all base maps that can be used. If multiple base maps are provided, they
can be toggled between using a "layer control" interface. By default, the
interface will use the provider names as labels, but users can define their
own using a named vector (e.g., |
legend |
Draw a shared legend? default: When multiple |
legend.position |
Position of the legend default: Where should the shared legend be placed? One of "topleft", "topright",
"bottomleft" or "bottomright". Passed to the |
control.collapsed |
Show the layer control as a collapsed? default: Should the "layer control" interface be collapsed? If |
control.position |
Position of the layer control menu default: Where should the "layer control" interface be placed? One of "topleft",
"topright", "bottomleft" or "bottomright". Passed to the |
A leaflet object.
## Not run: # view one network, grouped by site type networkMap(source = "aurn", control = "site_type") # view multiple networks, grouped by network networkMap(source = c("aurn", "waqn", "saqn"), control = "network") ## End(Not run)## Not run: # view one network, grouped by site type networkMap(source = "aurn", control = "site_type") # view multiple networks, grouped by network networkMap(source = c("aurn", "waqn", "saqn"), control = "network") ## End(Not run)
The percentileMap() function creates a map using polar percentile roses as
markers. Any number of pollutants can be specified using the pollutant
argument, and multiple layers of markers can be created using type. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
percentileMap( data, pollutant = NULL, percentile = c(25, 50, 75, 90, 95), intervals = "fixed", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )percentileMap( data, pollutant = NULL, percentile = c(25, 50, 75, 90, 95), intervals = "fixed", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with pollutant, wind, and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
pollutant |
Pollutant name(s). required | scope: dynamic & static The column name(s) of the pollutant(s) to plot. If multiple pollutants are
specified and a non-pairwise statistic is supplied, the
Multiple |
percentile |
The percentile values for the colour scale bin. default: The percentile value(s) to plot using |
intervals |
Specifier for the percentile rose radial axis intervals. default: One of:
|
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
diffMap(),
freqMap(),
polarMap(),
pollroseMap(),
windroseMap()
## Not run: percentileMap(polar_data, pollutant = "nox", provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: percentileMap(polar_data, pollutant = "nox", provider = "CartoDB.Voyager" ) ## End(Not run)
The polar_data dataset is provided as an example dataset as part of
the openairmaps package. The dataset contains hourly measurements of
air pollutant concentrations, location and meteorological data.
polar_datapolar_data
An object of class tbl_df (inherits from tbl, data.frame) with 35040 rows and 13 columns.
The date and time of the measurement
Pollutant concentrations
The site name. Useful for use with the popup and label arguments in openairmaps functions.
Decimal latitude and longitude of the sites.
Site type of the site (either "Urban Traffic" or "Urban Background").
Wind direction, in degrees from North, as a numeric vector.
Wind speed, in m/s, as numeric vector.
The visibility in metres.
Air temperature in degrees Celcius.
polar_data was compiled from data using the
openair::importAURN() function from the openair package with
meteorological data from the worldmet package.
polar_datapolar_data
The polarMap() function creates a map using bivariate polar plots as
markers. Any number of pollutants can be specified using the pollutant
argument, and multiple layers of markers can be created using type. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
polarMap( data, pollutant = NULL, x = "ws", limits = "free", upper = "fixed", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )polarMap( data, pollutant = NULL, x = "ws", limits = "free", upper = "fixed", latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with pollutant, wind, and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
pollutant |
Pollutant name(s). required | scope: dynamic & static The column name(s) of the pollutant(s) to plot. If multiple pollutants are
specified and a non-pairwise statistic is supplied, the
Multiple |
x |
The radial axis variable. default: The column name for the radial axis variable to use in
|
limits |
Specifier for the plot colour scale bounds. default: One of:
|
upper |
Specifier for the polar plot radial axis upper boundary. default: One of:
|
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
diffMap(),
freqMap(),
percentileMap(),
pollroseMap(),
windroseMap()
## Not run: polarMap(polar_data, pollutant = "nox", x = "ws", provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: polarMap(polar_data, pollutant = "nox", x = "ws", provider = "CartoDB.Voyager" ) ## End(Not run)
The pollroseMap() function creates a map using pollution roses as markers.
Any number of pollutants can be specified using the pollutant argument, and
multiple layers of markers can be created using type. By default, these
maps are dynamic and can be panned, zoomed, and otherwise interacted with.
Using the static argument allows for static images to be produced instead.
pollroseMap( data, pollutant = NULL, statistic = "prop.count", breaks = NULL, latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )pollroseMap( data, pollutant = NULL, statistic = "prop.count", breaks = NULL, latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with pollutant, wind, and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
pollutant |
Pollutant name(s). required | scope: dynamic & static The column name(s) of the pollutant(s) to plot. If multiple pollutants are
specified and a non-pairwise statistic is supplied, the
Multiple |
statistic |
The statistic to be applied to each data bin in the plot default: Options currently include |
breaks |
Specifier for the number of breaks of the colour axis. default: Most commonly, the number of break points. If not specified, each marker
will independently break its supplied data at approximately 6 sensible
break points. When |
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
diffMap(),
freqMap(),
percentileMap(),
polarMap(),
windroseMap()
## Not run: pollroseMap(polar_data, pollutant = "nox", statistic = "prop.count", provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: pollroseMap(polar_data, pollutant = "nox", statistic = "prop.count", provider = "CartoDB.Voyager" ) ## End(Not run)
openairmaps
Workhorse function that automatically applies routine text formatting to
common pollutant names which may be used in the HTML widgets produced by
openairmaps.
quickTextHTML(text)quickTextHTML(text)
text |
A character vector. required A character vector containing common pollutant names to be formatted. Commonly, this will insert super- and subscript HTML tags, e.g., "NO2" will be replaced with "NO2". |
quickTextHTML() is routine formatting lookup table. It screens the supplied
character vector text and automatically applies formatting to any
recognised character sub-series to properly render in HTML.
a character vector
Jack Davison.
openair::quickText(), useful for non-HTML/static maps and plots
labs <- c("no2", "o3", "so2") quickTextHTML(labs)labs <- c("no2", "o3", "so2") quickTextHTML(labs)
The traj_data dataset is provided as an example dataset as part of the
openairmaps package. The dataset contains HYSPLIT back trajectory data for
air mass parcels arriving in London in 2009. It has been joined with air
quality pollutant concentrations from the "London N. Kensington" AURN urban
background monitoring site.
traj_datatraj_data
An object of class tbl_df (inherits from tbl, data.frame) with 5432 rows and 17 columns.
The arrival time of the air-mass
The receptor number
Trajectory year
Trajectory month
Trajectory day
Trajectory hour
Trajectory hour offset from the arrival date
Latitude
Longitude
Height of trajectory in m
Pressure of the trajectory in Pa
Date of the trajectory
Concentration of oxides of nitrogen (NO + NO2)
Concentration of nitrogen dioxide (NO2)
Concentration of ozone (O3)
Concentration of particulates (PM10)
Concentration of fine particulates (PM2.5)
traj_data was compiled from data using the openair::importTraj()
function from the openair package with air quality data from
openair::importAURN() function.
traj_datatraj_data
leaflet
This function plots back trajectories on a leaflet map. This function
requires that data are imported using the openair::importTraj() function.
trajLevelMap( data, longitude = "lon", latitude = "lat", pollutant, type = NULL, smooth = FALSE, statistic = "frequency", percentile = 90, lon.inc = 1, lat.inc = 1, breaks = NULL, min.bin = 1, .combine = NULL, sigma = 1.5, cols = "turbo", alpha = 0.5, tile.border = NA, provider = "OpenStreetMap", legend.position = "topright", legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright" )trajLevelMap( data, longitude = "lon", latitude = "lat", pollutant, type = NULL, smooth = FALSE, statistic = "frequency", percentile = 90, lon.inc = 1, lat.inc = 1, breaks = NULL, min.bin = 1, .combine = NULL, sigma = 1.5, cols = "turbo", alpha = 0.5, tile.border = NA, provider = "OpenStreetMap", legend.position = "topright", legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright" )
data |
A data frame containing a HYSPLIT trajectory, perhaps accessed
with required A data frame containing HYSPLIT model outputs. If this data were not
obtained using |
latitude, longitude
|
The decimal latitude/longitude. default: Column names representing the decimal latitude and longitude. |
pollutant |
Pollutant (or any numeric column) to be plotted, if any.
Alternatively, use |
type |
A method to condition the default: Used for splitting the trajectories into different groups which can be
selected between using a "layer control" menu. Passed to
|
smooth |
Should the trajectory surface be smoothed? Defaults to |
statistic |
One of:
|
percentile |
The percentile concentration of |
lon.inc, lat.inc
|
The longitude and latitude intervals to be used for
binning data. If |
breaks |
|
min.bin |
The minimum number of unique points in a grid cell. Counts
below |
.combine |
When statistic is "SQTBA" it is possible to combine lots of
receptor locations to derive a single map. |
sigma |
For the SQTBA approach |
cols |
The colours used for plotting, passed to
|
alpha |
Opacity of the tiles. Must be between |
tile.border |
Colour to use for the border of binned tiles. Defaults to
|
provider |
The basemap to be used. default: A single leaflet::providers. See http://leaflet-extras.github.io/leaflet-providers/preview/ for a list of all base maps that can be used. |
legend.position |
Position of the shared legend. default: Where should the legend be placed? One of "topright", "topright",
"bottomleft" or "bottomright". Passed to the |
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: Should the "layer control" interface be collapsed? If |
control.position |
Position of the layer control menu default: Where should the "layer control" interface be placed? One of "topleft",
"topright", "bottomleft" or "bottomright". Passed to the |
A leaflet object.
trajLevelMapStatic() for the static ggplot2 equivalent of
trajLevelMap()
Other interactive trajectory maps:
trajMap()
## Not run: trajLevelMap(traj_data, pollutant = "pm2.5", statistic = "pscf", min.bin = 10) ## End(Not run)## Not run: trajLevelMap(traj_data, pollutant = "pm2.5", statistic = "pscf", min.bin = 10) ## End(Not run)
ggplot2
These functions existed at a time when openair::trajPlot() and
openair::trajLevel() were written in lattice. Now they are written in
ggplot2, these functions have been deprecated and now pass all of their
arguments to their corresponding openair functions. They will be removed
in a future version of openairmaps.
trajLevelMapStatic(...) trajMapStatic(...)trajLevelMapStatic(...) trajMapStatic(...)
... |
Arguments passed to either |
leaflet
This function plots back trajectories on a leaflet map. This function
requires that data are imported using the openair::importTraj() function.
Options are provided to colour the individual trajectories (e.g., by
pollutant concentrations) or create "layer control" menus to show/hide
different layers.
trajMap( data, longitude = "lon", latitude = "lat", colour = NULL, type = NULL, cols = "default", alpha = 0.5, npoints = 12, provider = "OpenStreetMap", legend.position = "topright", legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control = NULL, ... )trajMap( data, longitude = "lon", latitude = "lat", colour = NULL, type = NULL, cols = "default", alpha = 0.5, npoints = 12, provider = "OpenStreetMap", legend.position = "topright", legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control = NULL, ... )
data |
A data frame containing a HYSPLIT trajectory, perhaps accessed
with required A data frame containing HYSPLIT model outputs. If this data were not
obtained using |
latitude, longitude
|
The decimal latitude/longitude. default: Column names representing the decimal latitude and longitude. |
colour |
Column to be used for colouring each trajectory. default: This column may be numeric, character, factor or date(time). This will
commonly be a pollutant concentration which has been joined (e.g., by
|
type |
A method to condition the default: Used for splitting the trajectories into different groups which can be
selected between using a "layer control" menu. Passed to
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for trajectories. default: A value between |
npoints |
Interval at which points are placed along the trajectory paths. default: A dot is placed every |
provider |
The basemap to be used. default: A single leaflet::providers. See http://leaflet-extras.github.io/leaflet-providers/preview/ for a list of all base maps that can be used. |
legend.position |
Position of the shared legend. default: Where should the legend be placed? One of "topright", "topright",
"bottomleft" or "bottomright". Passed to the |
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: Should the "layer control" interface be collapsed? If |
control.position |
Position of the layer control menu default: Where should the "layer control" interface be placed? One of "topleft",
"topright", "bottomleft" or "bottomright". Passed to the |
control |
Deprecated. Please use |
... |
Arguments passed on to
|
A leaflet object.
trajMapStatic() for the static ggplot2 equivalent of trajMap()
Other interactive trajectory maps:
trajLevelMap()
## Not run: trajMap(traj_data, colour = "pm10") ## End(Not run)## Not run: trajMap(traj_data, colour = "pm10") ## End(Not run)
The windroseMap() function creates a map using wind roses as markers.
Multiple layers of markers can be created using the type argument. By
default, these maps are dynamic and can be panned, zoomed, and otherwise
interacted with. Using the static argument allows for static images to be
produced instead.
windroseMap( data, ws.int = 2, breaks = 4, latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )windroseMap( data, ws.int = 2, breaks = 4, latitude = NULL, longitude = NULL, crs = 4326, type = NULL, popup = NULL, label = NULL, provider = "OpenStreetMap", cols = "turbo", alpha = 1, theme = "default", key.position = "none", legend = TRUE, legend.position = NULL, legend.title = NULL, legend.title.autotext = TRUE, control.collapsed = FALSE, control.position = "topright", control.autotext = TRUE, d.icon = 200, d.fig = 3.5, static = FALSE, static.nrow = NULL, progress = TRUE, ..., control = NULL )
data |
Input data table with wind and geo-spatial information. required | scope: dynamic & static A data frame. The data frame must contain the data to plot the directional
analysis marker, which includes wind speed ( |
ws.int |
The wind speed interval of the colour axis. default: The wind speed interval. Default is 2 m/s but for low met masts with low mean wind speeds a value of 1 or 0.5 m/s may be better. |
breaks |
Specifier for the number of breaks of the colour axis. default: Most commonly, the number of break points for wind speed in
|
latitude, longitude
|
The decimal latitude(Y)/longitude(X). default: Column names representing the decimal latitude and longitude (or other Y/X
coordinate if using a different |
crs |
The coordinate reference system (CRS). default: The coordinate reference system (CRS) of the data, passed to
|
type |
A method to condition the default: Used for splitting the input data into different groups, passed to the
|
popup |
Content for marker popups on dynamic maps. default: Columns to be used as the HTML content for marker popups on dynamic maps.
Popups may be useful to show information about the individual sites (e.g.,
site names, codes, types, etc.). If a vector of column names are provided
they are passed to |
label |
Content for marker hover-over on dynamic maps. default: Column to be used as the HTML content for hover-over labels. Labels are useful for the same reasons as popups, though are typically shorter. |
provider |
The basemap(s) to be used. default: The base map(s) to be used for the map. If not provided, will default to
There is some overlap in static and dynamic providers. For example,
|
cols |
Colours to use for plotting. default: The colours used for plotting, passed to |
alpha |
Transparency value for polar markers. default: A value between 0 (fully transparent) and 1 (fully opaque). |
theme |
Custom ggplot2 theme for the polar markers. default: A custom |
key.position |
Legend position for individual marker legends. default: When |
legend |
Draw a shared legend? default: When all markers share the same colour scale (e.g., when |
legend.position |
Position of the shared legend. default: When
|
legend.title |
Title of the legend. default: By default, when |
legend.title.autotext |
Automatically format the title of the legend? default: When |
control.collapsed |
Show the layer control as a collapsed? default: For dynamic maps, should the "layer control" interface be collapsed? If
|
control.position |
Position of the layer control menu default: When |
control.autotext |
Automatically format the content of the layer control menu? default: When |
d.icon |
The diameter of the plot on the map in pixels. default: This will affect the size of the individual polar markers. Alternatively, a
vector in the form |
d.fig |
The diameter of the plots to be produced using default: This will affect the resolution of the markers on the map. Alternatively, a
vector in the form |
static |
Produce a static map? default: This controls whether a dynamic or static map is produced. The former is the default and is broadly more useful, but the latter may be preferable for DOCX or PDF outputs (e.g., academic papers). |
static.nrow |
Number of rows in a static map. default: Controls the number of rows of panels on a static map when multiple
|
progress |
Show a progress bar? default: By default, a progress bar is shown to visualise the function's progress creating individual polar markers. This option allows this to be turned off, if desired. |
... |
Arguments passed on to
|
control |
Deprecated. Please use |
Either:
Dynamic: A leaflet object
Static: A ggplot2 object using ggplot2::coord_sf() coordinates with a ggspatial basemap
Creating a directional analysis map can take a lot of time; each polar
marker needs to be plot individually, and many of these require some
expensive computations. openairmaps supports parallel processing with
{mirai} to speed these computations up. Users may create workers by
running mirai::daemons() in their R session.
mirai::daemons(4) polarMap(polar_data, "no2")
Typically, spawning one fewer daemons than your number of available cores
is a useful rule of thumb. Parallel processing will be most useful for the
most computationally intensive plotting functions - i.e., polarMap() and
annulusMap().
As all static plots functions are ggplot2 figures, further customisation
is possible using functions such as ggplot2::theme(), ggplot2::guides()
and ggplot2::labs().
Subscripting pollutants (e.g., the "x" in "NOx") is achieved using the
ggtext package. Therefore if you choose to override the
plot theme, it is recommended to use [ggplot2::theme()] and
[ggtext::element_markdown()] to define the strip.text parameter.
Legends can be removed using ggplot2::theme(legend.position = "none"), or
further customised using ggplot2::guides() and either color = ggplot2::guide_colourbar() for continuous legends or color = ggplot2::guide_legend() for discrete legends.
The extent of a map can be adjusted using the xlim and ylim arguments
of ggplot2::coord_sf().
polarMap(polar_data, "no2", static = TRUE) +
ggplot2::coord_sf(
xlim = c(-0.3, 0.2),
ylim = c(51.2, 51.8)
)
Other directional analysis maps:
annulusMap(),
diffMap(),
freqMap(),
percentileMap(),
polarMap(),
pollroseMap()
## Not run: windroseMap(polar_data, provider = "CartoDB.Voyager" ) ## End(Not run)## Not run: windroseMap(polar_data, provider = "CartoDB.Voyager" ) ## End(Not run)