plot_cpue_spatial: Plot a map of commercial CPUE or Catch (trawl only)

View source: R/cpue-map.R

plot_cpue_spatialR Documentation

Plot a map of commercial CPUE or Catch (trawl only)

Description

Plot a map of commercial CPUE or Catch (trawl only)

Usage

plot_cpue_spatial(
  dat,
  start_year = 2013,
  bin_width = 7,
  n_minimum_vessels = 3,
  xlim = c(122, 890),
  ylim = c(5373, 6027),
  utm_zone = 9,
  bath = c(100, 200, 500),
  fill_scale = ggplot2::scale_fill_viridis_c(trans = "sqrt", option = "D"),
  colour_scale = ggplot2::scale_colour_viridis_c(trans = "sqrt", option = "D"),
  rotation_angle = 0,
  rotation_center = c(500, 5700),
  fill_lab = ifelse(plot_catch, "Catch (t)", "CPUE (kg/hr)"),
  show_historical = FALSE,
  return_data = FALSE,
  min_cells = 1,
  french = FALSE,
  percent_excluded_xy = NULL,
  percent_excluded_text = "Fishing events excluded due to Privacy Act",
  show_majorbound = FALSE,
  major_labels = boundary_labels(utm_zone, xmin = xlim[1]),
  plot_catch = FALSE
)

plot_catch_spatial(...)

Arguments

dat

Data from gfdata::get_cpue_spatial(), gfdata::get_cpue_spatial_ll(), or gfdata::get_catch_spatial()

start_year

Starting year.

bin_width

Width of hexagons in km.

n_minimum_vessels

Minimum number of unique vessels before a hexagon is shown. Defaults to 3 to satisfy privacy requirements.

xlim

X axis limits in UTM units.

ylim

Y axis limits in UTM units.

utm_zone

UTM zone.

bath

A numeric vector of depths to show bathymetry countours at.

fill_scale

A ggplot ⁠scale_fill_*⁠ function to control colour shading.

colour_scale

A ggplot ⁠scale_colour_*⁠ function to control border of hexagon colours. This should likely match fill_scale.

rotation_angle

Angle to rotate the entire map. Used in the synopsis report to rotate the coast 40 degrees to fit more plots on the page.

rotation_center

The center in UTM coordinates around which to rotate the coast if it is rotated at all.

fill_lab

Label for the color legend.

show_historical

Should the historical extent of fishing (before start_year) be shown?

return_data

Logical for whether to return the data instead of the plot.

min_cells

The minimum number of cells needed before the hexagons are shown.

french

Logical for French or English.

percent_excluded_xy

If not NULL, should be a numeric vector of length 2 corresponding to the x and y location (as fraction from the bottom left) of text describing the percentage of fishing events excluded due to the privacy rule.

percent_excluded_text

The text to associate with the annotation showing the percentage of fishing events excluded due to the privacy rule.

show_majorbound

If TRUE, adds management boundaries.

major_labels

Default uses internal function boundary_labels() to retrieve a label dataframe. Function can be called and the output modified outside this function in order to customize label placement (e.g., labels <- gfplot:::boundary_labels(utm_zone = 9) labels[!(labels$label %in% c("4B", "5C", "5D")),]$X <- 200).

plot_catch

If TRUE plot catch instead of CPUE. If FALSE (default), plot CPUE. See dat for data information.

...

Arguments for plot_cpue_spatial().

Examples

## fake data demo:
xlim <- c(-134.1, -123.0)
ylim <- c(48.4, 54.25)
d <- dplyr::tibble(lat = runif(1000, min(ylim), max(ylim)),
  lon = runif(length(lat), min(xlim), max(xlim)),
  species_common_name = "fake species", fishing_event_id = 1,
  year = 2013, cpue = rlnorm(length(lat), log(1000), 0.6),
  vessel_registration_number = rep(seq_len(100), each = 10))
plot_cpue_spatial(d, bin_width = 15, n_minimum_vessels = 1)

pbs-assess/gfplot documentation built on April 3, 2024, 2:10 p.m.