trajMapStatic | R Documentation |
ggplot2
This function plots back trajectories using ggplot2
. The function
requires that data are imported using openair::importTraj()
. It is a
ggplot2
implementation of openair::trajPlot()
with many of the same
arguments, which should be more flexible for post-hoc changes.
trajMapStatic(
data,
colour = "height",
facet = NULL,
group = NULL,
longitude = "lon",
latitude = "lat",
npoints = 12,
xlim = NULL,
ylim = NULL,
crs = sf::st_crs(3812),
origin = TRUE,
map = TRUE,
map.fill = "grey85",
map.colour = "grey75",
map.alpha = 0.8,
map.lwd = 0.5,
map.lty = 1,
...
)
data |
Data frame, the result of importing a trajectory file using
|
colour |
Column to be used for colouring each trajectory. This column
may be numeric, character or factor. This will commonly be a pollutant
concentration which has been joined (e.g., by |
facet |
Used for splitting the trajectories into different panels.
Passed to |
group |
By default, trajectory paths are distinguished using the arrival
date. |
latitude, longitude |
The decimal latitude/longitude. |
npoints |
A dot is placed every |
xlim, ylim |
The x- and y-limits of the plot. If |
crs |
The coordinate reference system (CRS) into which all data should
be projected before plotting. Defaults to the Lambert projection
( |
origin |
Should the receptor point be marked with a circle? Defaults to
|
map |
Should a base map be drawn? Defaults to |
map.fill |
Colour to use to fill the polygons of the base map (see
|
map.colour |
Colour to use for the polygon borders of the base map (see
|
map.alpha |
Transparency of the base map polygons. Must be between |
map.lwd |
Line width of the base map polygon borders. |
map.lty |
Line type of the base map polygon borders. See
|
... |
Arguments passed on to
|
a ggplot2
plot
the original openair::trajPlot()
trajMap()
for the interactive leaflet
equivalent of
trajMapStatic()
Other static trajectory maps:
trajLevelMapStatic()
## Not run:
# colour by height
trajMapStatic(traj_data) +
ggplot2::scale_color_gradientn(colors = openair::openColours())
# colour by PM10, log transform scale
trajMapStatic(traj_data, colour = "pm10") +
ggplot2::scale_color_viridis_c(trans = "log10") +
ggplot2::labs(color = openair::quickText("PM10"))
# color by PM2.5, lat/lon projection
trajMapStatic(traj_data, colour = "pm2.5", crs = sf::st_crs(4326)) +
ggplot2::scale_color_viridis_c(option = "turbo") +
ggplot2::labs(color = openair::quickText("PM2.5"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.