Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use geom_ribbon() and map values to ymin
and ymax.
In the climate data set,
Anomaly10y is a 10-year running
average of the deviation (in Celsius) from the average 1950–1980
temperature, and Unc10y is the 95%
confidence interval. We’ll set ymax
and ymin to Anomaly10y plus or minus Unc10y (Figure 4-25):
library(gcookbook)# For the data set# Grab a subset of the climate dataclim<-subset(climate,Source=="Berkeley",select=c("Year","Anomaly10y","Unc10y"))climYear Anomaly10y Unc10y1800-0.4350.5051801-0.4530.4931802-0.4600.486...20030.8690.02820040.8840.029