Question

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!!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top