View source: R/plot-pacea-harbour-seals.R
plot.pacea_harbour_seals | R Documentation |
Default is to plot all seven regions plus the coastwide estimate, to mostly replicate Figure 3 of DFO (2022; see '?harbour_seals') in a 'ggplot' style. If a single region is indicated then a time series plot is shown, in the same style as plots of object class 'pacea_biomass' (such as 'hake_biomass'). Note that the values are means and confidence intervals (not medians and confidence intervals like other objects); see '?harbour_seals'.
## S3 method for class 'pacea_harbour_seals'
plot(
obj,
region = NULL,
value = "mean",
include_coastwide = TRUE,
xlab = "Year",
ylab = attr(obj, "axis_name"),
y_tick_by = 1000,
x_tick_extra_years = 20,
start_decade_ticks = lubridate::ymd("1800-01-01", truncated = 2),
y_max = NULL,
uncertainty_shade_col = rgb(0, 0, 1, 0.1),
uncertainty_line_col = "blue",
uncertainty_line_lty = 3,
median_type = "l",
median_pch = 16,
median_line_col = "black",
median_line_lty = 1,
median_line_lwd = 2,
...
)
obj |
'pacea_harbour_seals', as this is of class 'pacea_harbour_seals' and the plotting is tailored for this data set. |
region |
which region to plot for a single plot; must be one of SOG, WCVI, QCS, DP, CMC, NMC, HG, or coastwide. If 'NULL' (the default) then do a panel plot showing all seven regions. |
value |
the column to plot as a solid line, in this case always the default 'mean' |
include_coastwide |
logical, whether to include the coastwide population in the eight panel plot (keep 'region = NULL'). |
xlab |
x-axis label |
ylab |
y-axis label, the default is an attribute of the 'pacea_index' object. |
y_tick_by |
increment for y-axis ticks; gets overwritten in 'add_tickmarks()' if this yields more than 'y_tick_max_number' tickmarks. If using [plot.pacea_biomass()] the default of 1 gets automatically changed to 0.25 for 'plot(hake_biomass)'. |
x_tick_extra_years |
number of extra years to expand around the range of data for which to add annual tick marks (does not expand the axis); in hindsight could have simplified this in 'add_tickmarks()', but just made the default big here. |
start_decade_ticks |
where to start tickmarks for decades (defaults to 1800 as hard to automate) |
y_max |
maximum y value for certain types of plot (use this if you get an error when specifying 'ylim') |
uncertainty_shade_col |
colour of shading for uncertainty |
uncertainty_line_col |
colour of line for uncertainty |
uncertainty_line_lty |
lty of line for uncertainty |
median_type |
'type' of plot ("o", "p", etc.) for means (note: we have used median elsewhere so kept with that name, but the seal estimates are means not medians) |
median_pch |
pch for median |
median_line_col |
col for median |
median_line_lty |
lty for median |
median_line_lwd |
lwd for median |
... |
optional arguments passed onto 'plot()'. Note that the x-axis is constructed using a lubridate 'date' object, so 'xlim' needs to be a 'date' object (see example). |
plot of the time series as median with bars showing uncertainty (if 'low' and 'high' are columns of 'obj) to the current device; returns nothing.
Andrew Edwards
## Not run:
plot(harbour_seals)
plot(harbour_seals, region = "SOG")
plot(harbour_seals, include_coastwide = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.