Ridgeline Plots in 'ggplot2'

Ridgeline plots provide a convenient way of visualizing changes in distributions over time or space. This package enables the creation of such plots in 'ggplot2'.


Build Status Coverage Status CRAN_Status_Badge CRAN_Downloads_Badge

Geoms to make ridgeline plots using ggplot2, written by Claus O. Wilke

This package has now been officially relased on CRAN. Most things should work as expected, and the API should now be relatively stable. For feedback and feature requests, please open issues on github.

About ridgeline plots

Ridgeline plots are partially overlapping line plots that create the impression of a mountain range. They can be quite useful for visualizing changes in distributions over time or space. These types of plots have also been called "joyplots", in reference to the iconic cover art for Joy Division's album Unknown Pleasures. However, given the unfortunate origin of the name Joy Division, the term "joyplot" is now discouraged.

Installation

Stable release:

install.packages("ggridges")

Latest development version:

library(devtools)
install_github("clauswilke/ggridges")

Usage

library(ggplot2)
library(ggridges)
    
ggplot(diamonds, aes(x = price, y = cut)) +
  geom_density_ridges(scale = 4) + theme_ridges() +
  scale_y_discrete(expand = c(0.01, 0)) +   # will generally have to set the `expand` option
  scale_x_continuous(expand = c(0, 0))      # for both axes to remove unneeded padding

Documentation and Examples

First read the package vignette. Then read the reference manual.

News

ggridges 0.5.1

  • The alpha aesthetic is now by default applied to jittered points. If you don't want this to happen, set point_alpha = 1.
  • Allow custom function to calculate the position of quantile lines. This makes it possible, for example, to place a line at the mean, via quantile_fun = mean.
  • Allow coloring of quantile lines and jittered points by quantile.

ggridges 0.5.0

  • Expanded documentation and gallery of example plots.
  • Reworked stat_density_ridges, geom_ridgeline, geom_density_ridges, etc. so that jittered points and quantile lines can be drawn on top of the distributions. Points and quantile lines can be styled separately from the rest of the ridgeline plot, via special aesthetics.
  • Added position options to control how the jittered points are drawn. Default is uniformly spaced within the density area.
  • Added geom_density_line() which is a drop-in replacement for geom_density() but draws a ridgeline rather than a closed polygon.
  • theme_ridges() has been modified so that font sizes match the cowplot themes. In particular, this means smaller axis tick labels.

ggridges 0.4.1

  • Skip vdiffr visual tests when compiling on CRAN

ggridges 0.4.0

  • Initial import of code base from ggjoy, and renaming: geom_joy -> geom_density_ridges stat_joy -> stat_density_ridges theme_joy -> theme_ridges

ggjoy 0.3.0.9000

  • Added an option to center axis labels to theme_joy().

ggjoy 0.3.0

  • Added cyclical scales that make it easy to alternate between fill colors and other aesthetics.

ggjoy 0.2.0

Numerous improvements:

  • New stat binline that can be used to draw histogram joyplots.
  • Various improvements in stat_joy. In particular, it now works properly with multiple panels. It also now has parameters from and to to limit the range of density estimation, just like density().
  • Improvements in the vignettes
  • New geoms geom_ridgeline_gradient and geom_joy_gradient that can handle gradient fills.

ggjoy 0.1.0

First complete implementation ready for initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ggridges")

0.5.1 by Claus O. Wilke, 2 months ago


https://github.com/clauswilke/ggridges


Browse source code at https://github.com/cran/ggridges


Authors: Claus O. Wilke [cre, aut] , RStudio [cph] (Copyright for ggplot2 code copied to ggridges)


Documentation:   PDF Manual  


GPL-2 | file LICENSE license


Imports ggplot2, grid, plyr, scales, withr

Suggests covr, dplyr, gridExtra, ggplot2movies, DAAG, forcats, knitr, rmarkdown, testthat, vdiffr, viridis


Imported by HistDAWass, Seurat, bayesplot, cRegulome, dextergui, jmv, scatr, tidybayes, trackeR, userfriendlyscience.

Depended on by ggjoy.

Suggested by CAISEr, bench, sjPlot, sjstats, trialr.


See at CRAN