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.
shows the distribution of a numeric variable. In
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
graph #135 provides a few
guidelines on how to do so.
Use the theme_ipsum to improve the general appearance of the previous basic density chart.
Mirror density chart
Put 2 density charts face to face to compare the distribution of 2 numeric variables.
Multi density chart
Explains how to display several density charts on the same axis, and the potential associated caveats.
Multi density with annotation
It is a good practice to write group names next to shapes instead of adding a legend beside the chart.
If you have several groups, plotting them on the same axis often results in a cluttered and unreadable figure. Use small multiple to avoid that.
Stacked density chart
Stack groups on of top of each other. Allows to study the whole, but makes it hard to study each group.