
Add values to an existing plot
Source:R/ArraySpeciesBySize-class.R, R/ArrayTimeBySpecies-class.R
addPlot.Rd
addPlot() adds another set of values to an existing ggplot. The first
method supports adding an ArraySpeciesBySize object to a compatible plot,
for example to compare the same rate before and after a model change.
The method checks whether the existing plot uses a compatible x variable,
and warns if the y variable or y-axis units appear to differ.
Usage
addPlot(plot, x, ...)
# S3 method for class 'ArraySpeciesBySize'
addPlot(
plot,
x,
species = NULL,
all.sizes = FALSE,
wlim = c(NA, NA),
total = FALSE,
background = TRUE,
colour = NULL,
linetype = "dashed",
linewidth = 0.8,
alpha = 1,
...
)
# S3 method for class 'ArrayTimeBySpecies'
addPlot(
plot,
x,
species = NULL,
start_time = NULL,
end_time = NULL,
ylim = c(NA, NA),
total = FALSE,
background = TRUE,
colour = NULL,
linetype = "dashed",
linewidth = 0.8,
alpha = 1,
...
)Arguments
- plot
A ggplot2 object to which the new values should be added.
- x
An object containing the values to add.
- ...
Further arguments passed to methods.
- species
Character vector of species to include.
NULL(default) means all species.- all.sizes
If
FALSE(default), values outside a species' size range (w_mintow_max) are removed. Only applies toArraySpeciesBySize.- wlim
A numeric vector of length two providing lower and upper limits for the weight (x) axis. Use
NAto refer to the existing minimum or maximum. Only applies toArraySpeciesBySize.- total
A boolean value that determines whether the total over all selected species is plotted as well. Default is
FALSE.- background
A boolean value that determines whether background species are included. Ignored if the model does not contain background species. Default is
TRUE.- colour
Optional fixed colour for the added lines. If
NULL, the species colours from the existing plot are used.- linetype
Optional fixed line type for the added lines. If
NULL, the species line types from the existing plot are used.- linewidth
Width of the added lines.
- alpha
Transparency of the added lines.
- start_time
The first time to be plotted. Default (
NULL) is the beginning of the time series. Only applies toArrayTimeBySpecies.- end_time
The last time to be plotted. Default (
NULL) is the end of the time series. Only applies toArrayTimeBySpecies.- ylim
A numeric vector of length two providing lower and upper limits for the value (y) axis. Use
NAto refer to the existing minimum or maximum.
See also
Other plotting functions:
animate.ArrayTimeBySpeciesBySize(),
plot,
plotBiomass(),
plotDiet(),
plotFMort(),
plotFeedingLevel(),
plotGrowthCurves(),
plotMizerParams,
plotMizerSim,
plotPredMort(),
plotSpectra(),
plotYield(),
plotYieldGear(),
plotting_functions
Examples
# \donttest{
p <- plot(getEncounter(NS_params), species = "Cod")
addPlot(p, getEncounter(NS_params), species = "Cod")
# }