Plot Stock Recruit Relationship

plot_stock_recruitment(
  dat,
  spawning_biomass_label = "mt",
  recruitment_label = "mt",
  interactive = TRUE,
  era = NULL,
  module = NULL,
  scale_amount = 1,
  make_rda = FALSE,
  figures_dir = getwd()
)

Arguments

dat

A tibble or named list of tibbles (input as `list()`) returned from convert_output.

If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.

spawning_biomass_label

Units for spawning biomass

Default: "mt"

recruitment_label

units for recruitment

Default: "mt"

interactive

Indicate whether the environment the plot is being made in is interactive. By default, this is set to false. If true, dependent on your data, a option menu will pop-up.

Default: TRUE

era

A string naming the era of data.

Default: "time"

Options: "early", "time", "fore" (forecast), or NULL (all data)

module

(Optional) A string indicating the module_name found in `dat`. If selecting >1 module, place them in a vector like c("module1", "module2").

Default: NULL

If the interactive and >1 module_name is found, user will select the module_name in the console. @seealso [filter_data()]

scale_amount

A number to scale the y-axis values.

Default: 1

make_rda

A logical value indicating whether to save the object and make an automated caption and alternative text in the form of an `rda` object. If TRUE, the rda will be exported to the folder indicated in the argument "figures_dir".

Default: `FALSE`.

figures_dir

A string indicating a path to the "figures" folder.

Default: `getwd()`

The folder is created within the path if it does not exist.

Value

A plot showing the stock recruitment relationship.

Details

The input is from an assessment model output file translated to a standardized output (convert_output). There are options to return a `ggplot2` object or export an .rda object containing associated caption and alternative text for the figure.

See also

[convert_output()], [filter_data()], [process_data()], [plot_timeseries()], [export_kqs()], [insert_kqs()], [create_rda()]

Examples

plot_stock_recruitment(
  dat = stockplotr:::example_data,
  interactive = FALSE,
  spawning_biomass_label = "metric tons",
  recruitment_label = "metric tons",
  module = "DERIVED_QUANTITIES"
)
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.