plot_heatmap_sample_size_weight_at_age: Create a weight-at-age heatmap including extrapolated years

View source: R/plot-heatmap-sample-size-weight-at-age.R

plot_heatmap_sample_size_weight_at_ageR Documentation

Create a weight-at-age heatmap including extrapolated years

Description

Create a weight-at-age heatmap including extrapolated years

Usage

plot_heatmap_sample_size_weight_at_age(
  model,
  sample_size_df = NULL,
  fleet = 1,
  proj_line_color = "royalblue",
  proj_line_width = 1,
  proj_line_yr = NULL,
  yrs = NULL,
  cell_font_size = 4,
  sum_col_fill_color = "white",
  ...
)

Arguments

model

An list of results read in from an SS model using load_ss_files()

sample_size_df

A data frame where ages are columns (and start with the letter 'a'). If the values are zero, the weight-at-age was extrapolated/interpolated. If there is a value, the weight-at-age is data

fleet

An integer value specifying which fleet you want plotted. Fleet -2 will plot fecundity information. Fleet -1 will plot population weight-at-age for the middle of the year. Fleet 0 will plot population weight-at-age for the beginning of the year. Positive values for fleet will link to a modeled fleet.

proj_line_color

Line color to separate projection years.

proj_line_width

Line width to separate projection years.

yrs

A vector of the years to include in the table. If NULL, all years will be included

cell_font_size

Font size of the values printed in each cell of the table

sum_col_fill_color

The fill color for the row sum column

...

Arguments passed to 'heatmap_add_extrap_yrs_wa(), heatmap_get_wa_ggplot_vals(), and heatmap_set_colors()

Details

Produce a matrix of colors and values of weight-at-age information by year (y-axis) and age (x-axis). The plot uses output from a Stock Synthesis model.

Ages zero through the maximum age modeled in the data are shown for each year plotted. This maximum-age shown is found by removing ages that are the duplicate of the previous age, no user input is needed.

Users have many options to control what years are included in the plot. The beginning years of data can be removed using first_yr. Users do not have control over what are noted as projection years, which are all years after the end of the data included in the assessment model up to last year included in the weight-at-age matrix. These projection years are noted using a horizontal line but if the demarcation is not wanted, then they can change the line width to zero. Finally, users can calculate the colors using a range of data specified with first_yr and the last year of the data in the model. Then, the resulting plot can be truncated to a specified year range using print_yrs. The truncation is helpful to facilitate plots that fit on a single page or on a slide with readable values. Using this truncation, the colors would show trends across all plots made rather than just the truncated data.

Value

A ggplot2::ggplot() object


pacific-hake/hake-assessment documentation built on Jan. 14, 2025, 9:12 p.m.