View source: R/plotSubannual.R
plotSubannual | R Documentation |
For a list of Fields, plots the sub-annual cycles of the selected layers. Automatically splits data into separate panels based on Source, Quantity,
Sire and/or Region, but instead these can be distinguished by aesthetics - see the col.by
, linetype.by
and alpha.by
arguments.
Summary or aggregate function can optionally be applied and plotted on top.
plotSubannual(
fields,
layers = NULL,
gridcells = NULL,
title = NULL,
subtitle = NULL,
cols = NULL,
col.by = "Year",
col.labels = waiver(),
linetypes = NULL,
linetype.by = NULL,
linetype.labels = waiver(),
alphas = NULL,
alpha.by = NULL,
alpha.labels = waiver(),
linewidth = 0.5,
size = 3,
y.label = NULL,
x.label = NULL,
summary.function,
summary.function.label = deparse(substitute(summary.function)),
text.multiplier = NULL,
plot = TRUE,
...
)
fields |
The data to plot. Can be a Field or a 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. |
subtitle |
A character string to override the default subtitle. |
cols , linetypes , alphas |
A vector of colours, line types, or alpha values (respectively) to control the aesthetics of the lines. Only "cols" makes sense without a corresponding "xxx.by" argument (see above). The vectors can/should be named to match particular col/linetype/alpha values to particular Layers/Sources/Sites/Quantities/Regions. |
col.by , linetype.by , alpha.by |
Character strings defining the aspects of the data which which should be used to set the colour, line type and alpha (transparency).
Can meaningfully take the values "Layer", "Source", "Site", "Region" or "Quantity".
NOTE SPECIAL DEFAULT CASE: By default, |
col.labels , linetype.labels , alpha.labels |
A vector of character strings which are used as the labels for the lines. Must have the same length as the number of Sources/Layers/Sites/Quantities in the plot. The vectors can/should be named to match particular col/linewtype/alpha values to particular Layers/Sources/Sites/Quantities/Region. |
linewidth |
Numeric (as ggplot2), width of the lines on the plot, consistent with ggplot2. Note the width is doubled for the aggregate/summary line. |
size |
Numeric, size of the points for the aggregate/summary data, consistent with ggplot2. |
x.label , y.label |
Character strings (or expressions) for the x and y axes (optional) |
summary.function |
A function to summarise (aggregate) across year and plot on top. Obvious choice is |
summary.function.label |
An optional character string to give a pretty label to the summary function legend. |
text.multiplier |
A number specifying an overall multiplier for the text on the plot. Make it bigger if the text is too small on large plots and vice-versa. |
plot |
Boolean, if FALSE return a data.table with the final data instead of the ggplot object. This can be useful for inspecting the structure of the facetting columns, amongst other things. |
... |
Arguments passed to
|
Note that like all DGVMTools
plotting functions, plotSubannual
splits the data into separate panels using the ggplot2::facet_wrap()
. If you want to 'grid' the facets
using ggplot2::facet_grid()
you can do so afterwards. 'gridding the facets' implies the each column and row of facets vary by one specific aspect.
For example you might have one column for each Source, and one row for each "Quantity".
Returns either a ggplot2 object or a data.table (depending on the 'plot' argument)
Matthew Forrest matthew.forrest@senckenberg.de
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.