knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
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.
Please install the stable release from CRAN:
install.packages("ggridges")
Alternatively, you can install the latest development version from github:
remotes::install_github("wilkelab/ggridges")
library(ggplot2) library(ggridges) ggplot(diamonds, aes(x = price, y = cut)) + geom_density_ridges(scale = 4) + scale_y_discrete(expand = c(0, 0)) + # will generally have to set the `expand` option scale_x_continuous(expand = c(0, 0)) + # for both axes to remove unneeded padding coord_cartesian(clip = "off") + # to avoid clipping of the very top of the top ridgeline theme_ridges()
First read the package vignette. Then read the reference manual.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.