ggridges-helper: Helper functions to enhance ggridges package

ridges2barsR Documentation

Helper functions to enhance ggridges package

Description

ridges2bars() adds data points for ggridges::geom_ridgeline() to make bar-shaped ridgelines.

Usage

ridges2bars(.data, x, height, width = 0.9)

Arguments

.data

data.frame

x, height

Columns to transform

width

Bar width.

Examples

df_bars = tidyr::crossing(lambda = c(1, 2, 3), x = seq(0, 8)) |>
  dplyr::mutate(height = dpois(x, lambda)) |>
  ridges2bars(x, height) |>
  print()
ggplot2::ggplot(df_bars) +
  ggplot2::aes(x, lambda) +
  ggridges::geom_ridgeline(ggplot2::aes(height = height, group = lambda))
ggplot2::ggplot(df_bars) +
  ggplot2::aes(lambda, x) +
  ggridges::geom_vridgeline(ggplot2::aes(width = height, group = lambda))

heavywatal/rwtl documentation built on April 29, 2024, 2:02 a.m.