plot_weight_at_age: Create a plot of weight-at-age lines by age and year

View source: R/plot-weight-at-age.R

plot_weight_at_ageR Documentation

Create a plot of weight-at-age lines by age and year

Description

Create a plot of weight-at-age lines by age and year

Usage

plot_weight_at_age(
  wa,
  ages = NULL,
  bold_ages = NULL,
  cols = c("purple", "darkblue", "yellow", "darkgreen"),
  x_lim = c(start_yr_age_comps, last_data_yr),
  y_lim = c(0, 2),
  y_labs_by = 0.25,
  x_labels_mod = 5,
  x_labs_mod = 5,
  tick_prop = 1,
  vjust_x_labels = -1.5,
  remove_yr_labels = NULL,
  age_label_font_size = 4,
  age_label_side = "right",
  ...
)

Arguments

wa

A data frame of weight-at-age with a yr column and numerically-named columns for ages

ages

A vector of ages to plot. If NULL, all ages in the wa data frame will be plotted

bold_ages

A vector of ages to make bold in the plot. The lines for these ages will be thicker and the labels for them will be bold as well

cols

A vector of colors to base the color ramp on. See ggplot2::scale_color_gradientn()

x_lim

The min and max limits as a vector for the x-axis

y_lim

The min and max limits as a vector for the y-axis

x_labels_mod

Show every nth year where n is this number

x_labs_mod

How many years between year labels on the x-axis

tick_prop

A value that the length of the major tick marks are multiplied by. This proportion must be set by trial and error. Make sure to change vjust_x_labels so the labels are not overlapping the lines or are too far away from the lines

vjust_x_labels

Adjustment to move the x-axis tick labels and label up or down. Negative numbers move down

remove_yr_labels

A vector of years to remove the ,labels for in case they are overlapping

age_label_font_size

The font size for the labels pointing to the age lines

age_label_side

Where to place the age labels next to the lines. One of "none", "both", "left", or "right"

...

Arguments passed to ggrepel::geom_label_repel()

y_lab_by

The amount between each y-axis label

Value

A ggplot2::ggplot() object


pacific-hake/hake-assessment documentation built on Feb. 17, 2025, 1:58 p.m.