Plot Total Biomass at Age (BAA)

plot_biomass_at_age(
  dat,
  facet = NULL,
  unit_label = "mt",
  scale_amount = 1000,
  proportional = TRUE,
  module = NULL,
  interactive = TRUE,
  make_rda = FALSE,
  figures_dir = getwd()
)

Arguments

dat

Data frame. A data frame returned from convert_output

facet

Character vector. Column name or names used for faceting. Set facet = "none" to summarize the data in a single plot.

Default: NULL

Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL

unit_label

String. Abundance units

Default: "fish"

scale_amount

Number. A number describing how much to scale down the biomass at age. For example, scale_amount = 100 would scale down a value from 500,000 –> 5,000. This scale will be reflected in the legend label if proportion is set to FALSE.

Default: 1,000

proportional

Logical. TRUE/FALSE; set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size is relative to z

Default: `TRUE`

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()]

interactive

Logical. TRUE/FALSE; indicate whether the environment in which the function is operating is interactive. This bypasses some options for filtering when preparing data for the plot.

Default: `TRUE`

make_rda

Logical. TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, the .rda will be exported to the folder indicated in the argument "rda_dir".

Default: `FALSE`

figures_dir

Path. Folder containing the generated .rda files ("rda_files") that will be created if the argument `make_rda` = TRUE.

Default: the working directory (`getwd()`)

Value

A plot showing total biomass at age.

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_aa()], [export_kqs()], [insert_kqs()], [create_rda()]

Examples

plot_biomass_at_age(
  dat = stockplotr:::example_data,
  unit_label = "mt",
  scale_amount = 100,
  proportional = FALSE, # displays legend
  make_rda = FALSE
)
#> ! Multiple module names found in data. 
#>  Environment not interactive. Selecting BIOMASS_AT_AGE.
#> Joining with `by = join_by(year, sex, growth_pattern)`

plot_biomass_at_age(
  dat = stockplotr:::example_data,
  unit_label = "mt",
  facet = "none",
  proportional = FALSE
)
#> ! Multiple module names found in data. 
#>  Environment not interactive. Selecting BIOMASS_AT_AGE.
#> Joining with `by = join_by(year)`