plot_lengths | R Documentation |
Functions for plotting length frequency data.
plot_lengths(
dat,
xlab = "Length (cm)",
ylab = "Relative length frequency",
fill_col = c(M = "grey80", F = "#FF000010"),
line_col = c(M = "grey40", F = "red"),
survey_cols = NULL,
alpha = 0.24,
survey_facets = NULL,
bin_size = 2,
min_total = 20,
show_year = "even",
french = FALSE
)
dat |
A data frame from |
xlab |
X axis label. |
ylab |
Y axis label. |
fill_col |
Fill colours for histograms. A named vector with names
|
line_col |
Line colours for histograms. A named vector with names
|
survey_cols |
An optional named character vector of colors for the various surveys. |
alpha |
Transparency for the fill color in the histograms. |
bin_size |
Bin size. Should match the bin size used with the |
min_total |
Minimum number of fish for a given survey and year needed before a histogram is shown. |
show_year |
Which years to show a label for. Can be one of 'even' or 'odd'. Any other value will enable labels for all years. |
french |
French |
tidy_lengths_raw()
or tidy_lengths_weighted()
prepares PBS data for
plot_lengths()
. Works across one or multiple species.
plot_lengths()
Plots length frequencies for each year for selected
surveys for a single species.
## Not run:
# # main age/length data:
# rs_comm_samples <- gfdata::get_commercial_samples("redstripe rockfish")
# rs_survey_samples <- gfdata::get_survey_samples("redstripe rockfish")
#
# # for weighting:
# rs_catch <- gfdata::get_catch("redstripe rockfish")
# rs_survey_sets <- gfdata::get_survey_sets("redstripe rockfish")
# survey raw length frequencies:
tidy_lengths_raw(rs_survey_samples,
sample_type = "survey",
bin_size = 2) %>%
plot_lengths()
# survey weighted length frequencies:
tidy_lengths_weighted(rs_survey_samples,
sample_type = "survey",
bin_size = 2,
dat_survey_sets = rs_survey_sets) %>%
plot_lengths()
# commercial raw length frequencies:
tidy_lengths_raw(rs_comm_samples,
sample_type = "commercial",
bin_size = 2) %>%
plot_lengths()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.