Functions for plotting catch data over time as a stacked bar plot.
tidy_catch(dat, areas = NULL) plot_catch(dat, ylab = "Catch", xlim = c(1954, 2017), units = NULL, unreliable = c(1996, 2006), blank_plot = FALSE)
dat | Input data frame. For |
---|---|
areas | Fisheries and Oceans major statistical areas (eg.
3C, 3D, 5A, 5B, etc.). See gfplot::pbs_areas for a lookup table
with descriptions. Enter as a regular expression. For example, |
ylab | Y axis label. |
xlim | X axis limits in years. |
units | A named character vector with names referring to text that will
be pasted into the y-axis label and a value defining the quantity to divide
the |
unreliable | An optional numeric vector defining years before which the
data are less reliable. Leave as |
blank_plot | If |
tidy_catch()
Prepares PBS data for plot_catch()
. This works across one
or multiple species.
plot_catch()
Plots catch. The input data frame must come from
tidy_catch()
or have the columns (in any order): year
, gear
, value
(containing catches or landings).
# NOT RUN { d <- get_catch("lingcod") tidy_catch(d, areas = c("5[CDE]+", "5[AB]+", "3[CD]+")) %>% plot_catch() tidy_catch(d, areas = c("5A", "5B")) %>% plot_catch() # }