Line chart with error envelop : geom_ribbon()


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

Basic line chart with ggplot2 and geom_line()


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.




Contact

This document is a work of the statistics team in the Biostatistics and Medical Information Department at Saint-Louis Hospital in Paris (SBIM).
Based on The R Graph Gallery by Yan Holtz.

SBIM