1

I have made a simple boxplot in R, and am trying to turn the whiskers into rectangles. So the end result would be one rectangle (instead of a box with whiskers), with partitions at the 25th percentile, the median, and the 75th percentile. Is there any way to do this?

Thank you for all your help!!

1 Answers1

1

Try this:

# simulating dataset
set.seed(12)
d1 <- rnorm(100, sd=30)
d2 <- rnorm(100, sd=10)
d <- data.frame(value=c(d1,d2), condition=rep(c("A","B"),each=100))

# require(ggplot2)
ggplot(data=d, aes(x=condition, y=value, fill=condition)) + 
geom_crossbar(stat="summary", fun.y=quantile, fun.ymax=max, fun.ymin=min)

enter image description here

TWL
  • 2,290
  • 1
  • 17
  • 21