Plot the predicted biomass density by year.

map_density(
  predictions,
  save_prefix = fs::path(getwd(), "density"),
  n_row = 1,
  n_col = 2,
  column_grep = "^est[2]*$",
  tile_size = c(2000, 2000)
)

Arguments

predictions

Output from stats::predict().

save_prefix

A string providing the desired prefix to use when saving the density plots. The default is to save them in the current working directory using the name "density[0-9]{2}.png". Obviously, the same outcome would result from just "density" but the use of fs::path() in the default is present to provide an example for users who want to change the path to something other than their current directory.

n_row, n_col

Integers specifying the number of rows and columns for the faceted figures. The default is one row and two columns.

column_grep

A regular expression string that will be used to search the column names of predictions to find the column name that will be passed to ggplot2::geom_tile(ggplot2::aes(fill = )). The default results in either "est" or "est2" depending on if the model is a delta model or not.

tile_size

A vector of length two with numeric values specifying the tile width and height that will be passed to ggplot2::geom_tile(width, height).`

Value

A ggplot2 ggforce object is returned.

See also

Author

Chantel R. Wetzel