Graphics Reference
In-Depth Information
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
library(gcookbook)
# For the data set
# Grab a subset of the climate data
clim
<-
subset(climate, Source
==
"Berkeley"
,
select
=
c(
"Year"
,
"Anomaly10y"
,
"Unc10y"
))
clim
Year Anomaly10y Unc10y
1800
-0.435 0.505
1801
-0.453 0.493
1802
-0.460 0.486
...
2003
0.869 0.028
2004
0.884 0.029
# Shaded region
ggplot(clim, aes(x
=
Year, y
=
Anomaly10y))
+
geom_ribbon(aes(ymin
=
Anomaly10y
-
Unc10y, ymax
=
Anomaly10y
+
Unc10y),
alpha
=
0.2
)
+
geom_line()