Area chart





An area chart represents the evolution of a numeric variable. It is very close to a line chart. This section displays many examples build with R and ggplot2. Have a look to data-to-viz.com if want to learn more about line chart theory.

Note on area chart

This section is tightly linked with other sections. A line chart is the same but doesn't fill the surface between the line and the X axis. A connected scatterplot is almost the same thing, but each observation is represented as a dot. More generally, the time series section can interest you.

connected scatter line chart time series



Step by step with ggplot2

ggplot2 allows to draw line charts thanks to the geom_line() function. It expects as input a data frame with 2 numeric variables, one displayed on each axis. Start your journey with the most basic line chart.





Interactive version: plotly

The ggplotly() function of the plotly library makes it a breeze to build an interactive version. Try to hover circles to get a tooltip, or select an area of interest for zooming. Double click to reinitialize.

Get code




Interactive version: dygraph

The dygraph package is dedicated to time series visualization. It offers zooming, hovering, minimaps and much more. Visit the time series section that is dedicated to it for more.

Get code Time series section




Step by step with base R

In base R, the combination of the plot() and the polygon() functions allows to build quality area charts.

🌐 From the web

The web is full of astonishing R charts made by awesome bloggers. The R graph gallery tries to display some of the best creations and explain how their source code works. If you want to display your work here, please drop me a word or even better, submit a Pull Request!

Related chart types


Line plot
Area
Stacked area
Streamchart
Time Series