Learn R Programming

Tivy (version 0.1.1)

plot_juvenile_analysis: Plot juvenile analysis

Description

Creates comprehensive visualizations for juvenile fish analysis including bar charts, line plots, and comparative analyses. This function consolidates all juvenile plotting functionality.

Usage

plot_juvenile_analysis(
  data,
  x_var,
  fill_var = NULL,
  length_cols = NULL,
  a = 0.0012,
  b = 3.1242,
  x_date_breaks = NULL,
  plot_type = "bars",
  title = NULL,
  subtitle = NULL,
  sort_by = "x",
  color_palette = NULL,
  facet_var = NULL,
  facet_cols = 2,
  bar_position = "dodge",
  y_limits = c(0, 100),
  use_facet_wrap = TRUE,
  group_by_type = TRUE,
  reference_line = NULL,
  theme_style = "light",
  legend_position = "bottom",
  rotate_x_labels = TRUE,
  na_to_zero = FALSE
)

Value

ggplot object.

Arguments

data

Data frame with juvenile analysis data.

x_var

Column name for x-axis variable.

fill_var

Column name for fill/color variable.

length_cols

Vector of length frequency column names.

a

Length-weight relationship coefficient.

b

Length-weight relationship exponent.

x_date_breaks

Date breaks for x-axis (e.g., "1 day", "1 month").

plot_type

Plot type: "bars", "lines", "points", "mixed".

title

Plot title.

subtitle

Plot subtitle.

sort_by

Sorting method: "x", "number", "weight".

color_palette

Custom color palette.

facet_var

Variable for faceting.

facet_cols

Number of facet columns.

bar_position

Bar position: "dodge", "stack", "fill".

y_limits

Y-axis limits.

use_facet_wrap

Use facet wrap for juvenile type.

group_by_type

Group by juvenile type when not faceting.

reference_line

Reference line value (e.g., legal limit).

theme_style

Theme style: "classic", "minimal", "light", "dark".

legend_position

Legend position.

rotate_x_labels

Rotate x-axis labels.

na_to_zero

Convert NA values to zeros.

Examples

Run this code
if (FALSE) {
plot_juvenile_analysis(
  data = fishery_data,
  x_var = "date",
  length_cols = paste0("length_", seq(8, 15, 0.5))
)

plot_juvenile_analysis(
  data = fishery_data,
  x_var = "date",
  fill_var = "vessel",
  length_cols = length_columns,
  plot_type = "mixed",
  reference_line = 10,
  title = "Juvenile Analysis by Vessel and Date"
)
}

Run the code above in your browser using DataLab