plot_index: Comparison Plot of Estimated Indices of Relative Abundance

View source: R/plot_index.R

plot_indexR Documentation

Comparison Plot of Estimated Indices of Relative Abundance

Description

Compare estimated indices and their confidence intervals on a single plot. Results from Table_for_SS3.csv files are searched for and loaded as objects, which are then plotted by model run and area using unique colors for each run-area combination.

Usage

plot_index(
  dir,
  recursive = TRUE,
  area = NULL,
  filter = NULL,
  keepyears = NULL,
  limit = NULL,
  legend_position = c(0.5, 0.05),
  savefile = NULL
)

Arguments

dir

A file path with folders containing VASTWestCoast runs. Presumably each model run will be in its own folder, where these folder names are later used to name the lines on the figure.

recursive

A boolean value indicating whether or not you want to recursively search for VASTWestCoast runs inside dir or just look at the top level. The default is to look in all available folders.

area

A vector of character values specifying the areas to plot. The area is specified as the Fleet column in the csv file. The default is to keep all of the defined areas and partition the results by the folder it was found in and area using colors. NA values in the Fleet column will be changed to "unknown" and words separated using "_" will be separated using spaces, e.g., "All_areas" will become "All areas". Only the first underscore is replaced.

filter

A character value used for regex matching of the file names. The default is NULL, which leads to all files being used. Regular expression matching can help you subset for a given distribution, e.g., filter = "gamma", or for a specific survey, e.g., "Triennial". Note that folders can be separated with a forward or backwards slash depending on other arguments, but it is best to try "gamma/|lognormal/" if you only want files that are not sensitivity runs.

keepyears

A vector of years you want to plot. If NULL, which is the default, then all years are plotted.

limit

A upper limit of the vertical axis, which is forced. The default is to let the data define the upper limit, where all confidence intervals will be included.

legend_position

A vector of two numbers between zero and one that specify the location of the legend relative to the lower-left corner. The default values keeps the legend near the lower-left corner.

savefile

The file name that you want the results saved to. A full path can be specified, else the file will be saved in the current directory.

Value

A ggplot object that has been augmented to include the data used for the plot. This data set is available using [["dataforplot"]] and was created from sourced Table_for_SS3.csv files that were subset appropriately based on the input arguments. The ggplot object is also saved to the disk if !is.null(savefile) == TRUE.

Author(s)

Kelli F. Johnson


nwfsc-assess/VAST_WestCoast documentation built on July 4, 2023, 5:45 p.m.