barplot_stacked: Stacked barplot developed for plotting landings data by fleet...

View source: R/barplot_stacked.r

barplot_stackedR Documentation

Stacked barplot developed for plotting landings data by fleet and year

Description

Stacked barplot developed for plotting landings data by fleet and year

Usage

barplot_stacked(
  data,
  units,
  unit_scale = 1,
  ylab = "y-axis label",
  plot_prop_text = TRUE,
  prop_digits = 2,
  xlabBy = 5,
  leg_title = "",
  leg_bty = "n",
  ...
)

Arguments

data

data frame object. Intended for rows (x-axis) to be years, columns (groups) to be fleets, and values (y-axis) to be landings, discards, etc.

units

Text for printing the scale of values in ylab (e.g. fish, lb). character vector

unit_scale

Allows you to provide a numeric value to scale the values for plotting

ylab

y-label for plot. Note that if unit_scale!=0 then the value of unit_scale will be appended to the y-axis label.

plot_prop_text

should text be added to the plot indicating what proportion of the total values (sum(data)) are in each group? logical

prop_digits

Number of digits to display if plot_prop_text==TRUE

xlabBy

Specify frequency for plotting values along x-axis (e.g. 1, 5, 10)

leg_title

Title text for labeling legend. character vector

leg_bty

Pass to argument bty in legend (see legend) ...

Author(s)

Nikolai Klibansky

Examples

## Not run: 
barplot_stacked(rdat_BlackSeaBass$N.age,units="fish",unit_scale = 1e6,ylab="N",leg_title = "Age")
barplot_stacked(rdat_BlackSeaBass$N.age/1e6,units="million fish",ylab="N",leg_title = "Age")
barplot_stacked(rdat_BlackSeaBass$N.age/1e6,units="million fish",ylab="N",plot_prop_text=FALSE,leg_bty = "o")

## End(Not run)

nikolaifish/bamExtras documentation built on July 21, 2023, 8:26 a.m.