Welcome in the density plot section of the gallery. If you want to know more about this kind of chart, visit data-to-viz.com. If you're looking for a simple way to implement it in R, pick an example below.
ggplot2
libraryA density plot shows the distribution of a numeric variable. In ggplot2
, the geom_density()
function takes care of the kernel density estimation and plot the results. A common task in dataviz is to compare the distribution of several groups. The graph #135 provides a few guidelines on how to do so.