简体   繁体   中英

Turning whiskers into rectangles in boxplot in R

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

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)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM