Plot fishing mortality timeseries

plot_fishing_mortality(
  dat,
  geom = "line",
  group = NULL,
  facet = NULL,
  ref_line = "msy",
  era = "time",
  module = NULL,
  relative = FALSE,
  make_rda = FALSE,
  figures_dir = getwd(),
  interactive = TRUE,
  ...
)

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.

geom

A string stating the geom used for the plot.

Default: "line".

Options: "line", "point", or "area"

group

A string of a single column that groups the data (e.g. "fleet", "sex", "area", etc.).

Set group = "none" to summarize data over all indexing values.

Default: NULL

facet

A string or vector of strings of a column name.

Default: NULL

ref_line

A string specifying a reference point name.

Default: "target"

Options: (including, but not limited to) "target", "msy", and "unfished" If the reference point is not found in the data, set ref_line = c("name" = value).

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`.

Default: NULL

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

relative

A logical value specifying to set y-axis values relative to the ref_line value.

Default: `FALSE`

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.

interactive

A logical value indicating if the environment is interactive.

Default: `FALSE`

...

Arguments called from geom_line or geom_point

Value

Create a plot ready for a stock assessment report of fishing mortality over time from the results of an assessment model translated to the a standardized output (convert_output). Includes options to group or facet data where available. There are options to return a [ggplot2::ggplot()] object or export an rda object containing associated caption and alternative text for the figure.

Examples

plot_fishing_mortality(
  dat = stockplotr:::example_data,
  ref_line = c("target" = 0.2),
  group = "fleet",
  interactive = FALSE,
  module = "TIME_SERIES"
)
#> Ignoring unknown labels:
#>  linetype : "Fleet"
#>  shape : "Fleet"

plot_fishing_mortality(
  dat = stockplotr:::example_data,
  ref_line = c("target" = 0.2),
  group = "none",
  interactive = FALSE,
  module = "TIME_SERIES"
)