5.2 Revealing Uncertainty

Four primary types of geometric objects (geom) are used: 1. Discrete x, range: geom_errorbar(), geom_linerange() 2. Discrete x, range & center: geom_crossbar(), geom_pointrange() 3. Continuous x, range: geom_ribbon() 4. Continuous x, range & center: geom_smooth(stat = "identity")

y <- c(18, 11, 16)
df <- data.frame(x = 1:3, y = y, se = c(1.2, 0.5, 1.0))

base <- ggplot(df, aes(x, y, ymin = y - se, ymax = y + se))
base + geom_crossbar()

base + geom_pointrange()

base + geom_smooth(stat = "identity")

df
##   x  y  se
## 1 1 18 1.2
## 2 2 11 0.5
## 3 3 16 1.0
base + geom_errorbar()

base + geom_linerange()

base + geom_ribbon()