plot_param_density: Create a plot showing the density of the posterior for the...

View source: R/plot-param-density.R

plot_param_densityR Documentation

Create a plot showing the density of the posterior for the catch forecast for a given year

Description

Create a plot showing the density of the posterior for the catch forecast for a given year

Usage

plot_param_density(
  model,
  param_nm,
  prob_vec = probs,
  scale = 1000,
  x_lab = "",
  y_lab = "Density",
  x_lim = c(0, 3000),
  y_lim = c(0, 1e-04),
  expand_vec = c(0, 0),
  x_breaks = seq(x_lim[1], x_lim[2], by = (x_lim[2] - x_lim[1])/6),
  fill_color = ts_single_model_ribbon_fill,
  fill_alpha_tail = 0.3,
  fill_alpha_main = 0.7,
  show_y_labels = TRUE,
  show_med_label = TRUE,
  med_label_units = "kt",
  med_label_digits = 3,
  arrow_obj = arrow(length = unit(0.5, "cm"), angle = 20, type = "closed"),
  label_x_offset = 500,
  label_y_offset = 1e-04,
  ...
)

Arguments

model

The model output from Stock Synthesis as loaded by create_rds_file()

param_nm

A parameter name present in names(model$mcmc)

prob_vec

A vector of probabilities to use in the quantile() calculation

scale

A value to divide the parameter values by

x_lab

The x-axis label

y_lab

The y-axis label. Only shown if show_y_labels is TRUE

x_lim

A vector of two values. The x-axis minimum and maximum values

expand_vec

A vector to pass to the expand argument of the ggplot2::scale_x_continuous() function. Default is c(0, 0)

fill_color

The color used to fill under the density curve

fill_alpha_tail

The transparency used for the color of the tails

fill_alpha_main

The transparency used for the color of the main part of the curve (-1SD - 1SD)

show_y_labels

Logical. If TRUE, show the y-axis label , ticks, and tick labels

show_med_label

Logical. If TRUE, show the median label with arrow

med_label_units

Units (as text) to place in the label showing the median. Only used if show_med_label is TRUE

label_x_offset

An x-axis offset to move the median label to, Positive means move right. Only used if show_med_label is TRUE

label_y_offset

A y-axis offset to move the median label to, Positive means move up. Only used if show_med_label is 'TRUE

...

Arguments to pass to theme_axis_text()

show_med_digits

Number of decimal places to show in the median label. Only used if show_med_label is TRUE

Value

A ggplot2::ggplot() object


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