| trajPlot | R Documentation |
This function plots back trajectories. This function requires that data are
imported using the importTraj() function, or matches that structure.
trajPlot(
mydata,
lon = "lon",
lat = "lat",
pollutant = NULL,
type = "default",
map = TRUE,
group = NULL,
cols = "default",
crs = 4326,
map.fill = TRUE,
map.cols = "grey40",
map.border = "black",
map.alpha = 0.4,
map.lwd = 1,
map.lty = 1,
grid.col = "deepskyblue",
grid.nx = 9,
grid.ny = grid.nx,
npoints = 12,
origin = TRUE,
key.title = group,
key.position = "right",
key.columns = 1,
strip.position = "top",
auto.text = TRUE,
plot = TRUE,
key = NULL,
...
)
mydata |
Data frame, the result of importing a trajectory file using
|
lon, lat |
Columns containing the decimal longitude and latitude. |
pollutant |
Pollutant (or any numeric column) to be plotted, if any.
Alternatively, use |
type |
Character string(s) defining how data should be split/conditioned
before plotting.
Most |
map |
Should a base map be drawn? If |
group |
A condition to colour the plot by, passed to |
cols |
Colours to use for plotting. Can be a pre-set palette (e.g.,
|
crs |
The coordinate reference system to use for plotting. Defaults to
|
map.fill |
Should the base map be a filled polygon? Default is to fill countries. |
map.cols |
If |
map.border |
The colour to use for the map outlines/borders. Defaults to
|
map.alpha |
The transparency level of the filled map which takes values from 0 (full transparency) to 1 (full opacity). Setting it below 1 can help view trajectories, trajectory surfaces etc. and a filled base map. |
map.lwd |
The map line width, a positive number, defaulting to |
map.lty |
The map line type. Line types can either be specified as an
integer ( |
grid.col |
The colour of the map grid to be used. To remove the grid set
|
grid.nx, grid.ny |
The approximate number of ticks to draw on the map
grid. |
npoints |
A dot is placed every |
origin |
If true a filled circle dot is shown to mark the receptor point. |
key.title |
Used to set the title of the legend. The legend title is
passed to |
key.position |
Location where the legend is to be placed. Allowed
arguments include |
key.columns |
Number of columns to be used in a categorical legend. With
many categories a single column can make to key too wide. The user can thus
choose to use several columns by setting |
strip.position |
Location where the facet 'strips' are located when
using |
auto.text |
Either |
plot |
When |
key |
Deprecated; please use |
... |
Addition options are passed on to
|
Several types of trajectory plot are available:
trajPlot() by default will plot each lat/lon location showing the origin
of each trajectory, if no pollutant is supplied.
If a pollutant is given, by merging the trajectory data with concentration
data, the trajectories are colour-coded by the concentration of pollutant.
With a long time series there can be lots of overplotting making it difficult
to gauge the overall concentration pattern. In these cases setting alpha to
a low value e.g. 0.1 can help.
The user can also show points instead of lines by plot.type = "p".
Note that trajPlot() will plot only the full length trajectories. This
should be remembered when selecting only part of a year to plot.
David Carslaw
Jack Davison
Other trajectory analysis functions:
importTraj(),
trajCluster(),
trajLevel()
## Not run:
# show a simple case with no pollutant i.e. just the trajectories
# let's check to see where the trajectories were coming from when
# Heathrow Airport was closed due to the Icelandic volcanic eruption
# 15--21 April 2010.
# import trajectories for London and plot
lond <- importTraj("london", 2010)
# well, HYSPLIT seems to think there certainly were conditions where trajectories
# orginated from Iceland...
trajPlot(selectByDate(lond, start = "15/4/2010", end = "21/4/2010"))
# plot by day, need a column that makes a date
lond$day <- as.Date(lond$date)
trajPlot(
selectByDate(lond, start = "15/4/2010", end = "21/4/2010"),
type = "day"
)
# or show each day grouped by colour, with some other options set
trajPlot(
selectByDate(lond, start = "15/4/2010", end = "21/4/2010"),
group = "day",
cols = "turbo",
key.position = "right",
key.columns = 1,
lwd = 2,
cex = 4
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.