ridges2bars | R Documentation |
ridges2bars()
adds data points for ggridges::geom_ridgeline()
to make bar-shaped ridgelines.
ridges2bars(.data, x, height, width = 0.9)
.data |
data.frame |
x , height |
Columns to transform |
width |
Bar width. |
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.