plotTemporal | R Documentation |
Makes a line plot graphing the temporal evolution of data (using ggplot2). Allows control of panel layout and line aesthetics whilst simultaneously plotting multiple Sources, Layers, Gridcells (Sites) and Quantities.
plotTemporal(
fields,
layers = NULL,
gridcells = NULL,
title = character(0),
subtitle = character(0),
cols = NULL,
col.by = "Layer",
col.labels = waiver(),
linetypes = NULL,
linetype.by = NULL,
linetype.labels = waiver(),
linewidths = NULL,
linewidth.by = NULL,
linewidth.labels = waiver(),
sizes = NULL,
size.by = NULL,
size.labels = waiver(),
shapes = NULL,
shape.by = NULL,
shape.labels = waiver(),
alphas = NULL,
alpha.by = NULL,
alpha.labels = waiver(),
y.label = NULL,
y.lim = NULL,
x.label = NULL,
x.lim = NULL,
points = FALSE,
legend.position = "bottom",
text.multiplier = NULL,
dropEmpty = FALSE,
plotTrend = FALSE,
plot = TRUE,
...
)
fields |
The data to be plotted, either as a Field or list of Fields. |
layers |
A list of strings specifying which layers to plot. Defaults to all layers. |
gridcells |
A list of gridcells to be plotted (either in different panels or the same panel). For formatting of this argument see |
title |
A character string to override the default title. Set to NULL for no title. |
subtitle |
A character string to override the default subtitle. Set to NULL for no subtitle. |
cols , linetypes , linewidths , sizes , shapes , alphas |
Values of colours, line types, line width, point sizes, point shapes or alpha values (respectively). These can either be a single values if the aesthetic has not specified by xxx.by argument above of a vector of values, or a vector of values which can/should be named to match particular col/size/linetype/shape/alpha values to particular Layers/Sources/Sites/Quantities. |
col.by , linetype.by , linewidth.by , size.by , shape.by , alpha.by |
Character strings defining the aspects of the data which which should be used to set the colour, line type, line width, point size and point shape and alpha (transparency).
Can meaningfully take the values "Layer", "Source", "Site" or "Quantity". By default |
col.labels , linetype.labels , linewidth.labels , size.labels , shape.labels , alpha.labels |
A vector of character strings which are used as the labels for the lines/points. Must have the same length as the number of Sources/Layers/Site/Quantities in the plot. The vectors can/should be named to match particular col/size/linetype/linewidth/shape/alpha values to particular Layers/Sources/Sites/Quantities. |
x.label , y.label |
Character strings (or expressions) for the x and y axes (optional) |
x.lim , y.lim |
Limits for the x and y axes (each a two-element numeric, optional) |
points |
Logical, if TRUE plot data as points (with geom_points) instead of lines (with geom_lines). Good for plotting time series with missing data where geom_lines joins lines over the gaps which is not helpful |
legend.position |
Position of the legend, in the ggplot2 style. Passed to the ggplot function |
text.multiplier |
A number specifying an overall multiplier for the text on the plot. |
dropEmpty |
Logical, if TRUE don't plot time series lines consisting only of zeros (default is FALSE). |
plotTrend |
Logical, if TRUE plot the linear trend (default is FALSE) |
plot |
Logical, if FALSE return the data.table of data instead of the plot |
... |
Arguments passed to
|
It allows fairly fine-grained control with respect to labelling lines corresponding to different Sources, Layers, Sites and Quantities with different colours, sizes, linetypes, alpha (transparency) values, and text labels. It also allows one to decide if you want different Sources/Layers/Quantities on the same panel or on different panels. The default is to put different Sources (ie. runs and datasets) and Quantities (ie different output variables) on different panels, and Layers on the same panel distinguished by colour.
A ggplot
Matthew Forrest matthew.forrest@senckenberg.de
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.