Line chart with error envelop: ggplot2 and geom_ribbon() – the R Graph Gallery

Line chart with error envelop: ggplot2 and geom_ribbon()



This post explains how to add an error envelop around a line chart using ggplot2 and the geom_ribbon() function.

Line chart Section About line chart

Basic line chart with ggplot2 and geom_line()


This graph has been made by Alastair Sanderson. You can have a look to his gallery here.

It shows mean temperature profiles and their error envelopes, using the ggplot2 package and its geom_ribbon() function.

Note that geom_ribbon is used since upper and lower values of the envelop are available in the input data. As an alternative, the geom_smooth function autamatically draw an error envelop using different statistical models.

Related chart types


Line plot
Area
Stacked area
Streamchart
Time Series



❤️ 10 best R tricks ❤️

👋 After crafting hundreds of R charts over 12 years, I've distilled my top 10 tips and tricks. Receive them via email! One insight per day for the next 10 days! 🔥