library(ggplot2)
# Generate data
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
h <- ggplot(huron, aes(y = year))
h + geom_ribbonh(aes(xmin=0, xmax=level))
h + geom_areah(aes(x = level))
# Add aesthetic mappings
h +
geom_ribbonh(aes(xmin = level - 1, xmax = level + 1), fill = "grey70") +
geom_lineh(aes(x = level))
Run the code above in your browser using DataLab