View source: R/plot-weights-lengths.R
plot_weights_lengths | R Documentation |
Plot some years of weight of length histograms
plot_weights_lengths(
df,
type = c("length", "weight"),
include_sex = TRUE,
min_total = 20,
bin_width = 0.075,
x_breaks = pretty(d[[bin_col]], 4L),
label_font_size = 2.25,
fill_col = c(F = rgb(1, 0, 0, 0.3), M = rgb(0, 0, 1, 0.3)),
line_col = c(F = rgb(1, 0, 0, 0.3), M = rgb(0, 0, 1, 0.3)),
unsexed_fill_col = rgb(0, 0, 1, 0.3),
unsexed_col = "black",
unit_str = ifelse(type == "length", "cm", "kg")
)
df |
A data frame as returned by |
type |
Either "length" or "weight" |
include_sex |
Logical. If |
min_total |
Minimum number of fish for a given survey and year needed before a histogram is shown. |
bin_width |
The width of the bars in units of the plot |
x_breaks |
A vector of values to show on the x-axis as tick labels |
label_font_size |
The font size for the sample size labels |
fill_col |
A named vector of two colors for Female and male bars. The names are "F" and "M" respectively. |
line_col |
A named vector of two colors for Female and male bar outlines. The names are "F" and "M" respectively. |
unsexed_fill_col |
The color to use for non-sex-specific bar fill |
unsexed_col |
Thew color to use for the bar border for unsexed bars |
unit_str |
A string representing the units, e.g. 'g' or 'kg' |
A ggplot2::ggplot()
object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.