plot_sample_avail: Plot sample availability

View source: R/samples.R

plot_sample_availR Documentation

Plot sample availability

Description

Plot sample availability

Usage

plot_sample_avail(
  dat,
  year_range = NULL,
  title = "Biological samples",
  palette = "Greys",
  trans = sqrt,
  french = FALSE,
  text_colour = "white"
)

Arguments

dat

An input data frame from, for example, tidy_sample_avail(). The input data frame must have the columns:

year

The year.

type

The types of samples to plot, e.g. "maturity", "weight", "age". The axis labels will be derived from type after capitalizing the first letter.

n

The number of samples available for that sample type.

year_range

An optional year range.

title

A title for the plot.

palette

A palette to pass to ggplot2::scale_fill_distiller().

trans

A function to transform the counts before applying the color scale. E.g. sqrt or log or I if you don't want any transformation.

french

Logical.

text_colour

Colour for the value text labels

Examples

set.seed(1)
d <- expand.grid(year = 1996:2016,
  type = c("maturity", "weight", "length", "age"), stringsAsFactors = FALSE)
d$n <- round(runif(nrow(d), 0, 800))
d$n[10] <- 0 # example zero
plot_sample_avail(d)

## Not run: 
d <- gfdata::get_survey_samples("lingcod")
d <- tidy_sample_avail(d, year_range = c(1996, 2016))
plot_sample_avail(d, year_range = c(1996, 2016),
  title = "Survey samples")

d <- gfdata::get_commercial_samples("lingcod")
d <- tidy_sample_avail(d, year_range = c(1996, 2016))
plot_sample_avail(d, year_range = c(1996, 2016),
  title = "Commercial samples")

## End(Not run)

seananderson/pbs-synopsis documentation built on April 4, 2024, 1:36 p.m.