plotSizeCompsAsRidges: Plot annual size comps (or other similar) using 'ggridges'

View source: R/plotSizeCompsAsRidges.R

plotSizeCompsAsRidgesR Documentation

Plot annual size comps (or other similar) using ggridges

Description

Function to plot annual size comps (or other similar) using ggridges

Usage

plotSizeCompsAsRidges(
  dfr_,
  sizes_in = "size",
  values_in = "abundance",
  y_positions = "year",
  removeZeros = TRUE,
  reverseY = FALSE,
  colour = NULL,
  fill = NULL,
  group_by = y_positions,
  normalize_by = NULL,
  xlim = c(100, 200),
  ylim = c(1980, 2022),
  x_breaks = seq(5, 200, 5),
  y_breaks = seq(1900, 2100, 5),
  legend.position = c(0.98, 0.98),
  legend.justification = c(1, 1)
)

Arguments

dfr_

: input dataframe

sizes_in

: name of column with "size" information (default = "size")

values_in

: name of column with "abundance" information (default = "abundance")

y_positions

: name of column with vertical axis location information (default = "year")

removeZeros

: remove comps with zero abundance in all bins(default = TRUE)

reverseY

: reverse y scale (default = FALSE)

colour

: column name colour variable (default = NULL)

fill

: column name for fill variable (default = NULL)

group_by

: string vector with column names for grouping before summarizing (default = value of y_positions)

normalize_by

: string vector with column names for grouping before normalizing (default = NULL)

xlim

: x axis limits (default = c(0,200))

ylim

: y axis limits (default = c(1980,2022))

x_breaks

: x axis breaks (default = seq(5,200,5))

y_breaks

: y axis breaks (default = seq(1900,2100,5))

legend.position

: legend position (as in [ggplot2::theme()], default = c(0.98,0.98))

legend.justification

: legend justification on plot (as in [ggplot2::theme()], default = c(1,1))

Details

Uses [ggridges::geom_density_ridges()] to plot the size compositions. The returned plot object can be faceted, etc., for more complex plotting situations.

Value

ggplot2 plot object


wStockhausen/wtsSizeComps documentation built on March 17, 2024, 3:09 p.m.