Skip to contents

This function plots the stock-recruitment relationship (SRR) using ggplot2. It can handle multiple models and provides flexibility in display options.

Usage

plot_srr(
  M,
  ylab = "Recruits (age 1, millions)",
  xlab = "Female spawning biomass (kt)",
  ylim = NULL,
  xlim = NULL,
  alpha = 0.05,
  ebar = "FALSE",
  leglabs = NULL,
  coverlap = FALSE,
  sizein = 3,
  sizeout = 2,
  yrsin = 1977:2019
)

Arguments

M

A list or data structure containing model results.

ylab

Label for the y-axis. Default is "Recruits (age 1, millions)".

xlab

Label for the x-axis. Default is "Female spawning biomass (kt)".

ylim

Limits for the y-axis. Default is NULL.

xlim

Limits for the x-axis. Default is NULL.

alpha

Alpha for the ribbons indicating uncertainty. Default is 0.05.

ebar

Logical, if TRUE error bars will be plotted. Default is FALSE.

leglabs

Custom labels for the legend. Default is NULL.

coverlap

Logical, if TRUE overlapping text labels will be checked and prevented. Default is FALSE.

sizein

Font size for the in-sample text labels. Default is 3.

sizeout

Font size for the out-of-sample text labels. Default is 2.

yrsin

Years to be considered for in-sample. Default is 1977:2019.

Value

A ggplot object containing the SRR plot.

Examples

# Assuming 'model_list' contains the relevant model results:
# plot_srr(M = model_list, ylim = c(0, 1e6), xlim = c(0, 2000))