geom_boxplot with precomputed values

This works using ggplot2 version 0.9.1 (and R 2.15.0)

library(ggplot2)

DF <- data.frame(x=c("A","B"), min=c(1,2), low=c(2,3), mid=c(3,4), top=c(4,5), max=c(5,6))

ggplot(DF, aes(x=x, ymin = min, lower = low, middle = mid, upper = top, ymax = max)) +
  geom_boxplot(stat = "identity")

enter image description here

See the “Using precomputed statistics” example here

Leave a Comment