For some reason I do not get a correct boxplot (the line that runs til ymax and ymin)
This is the code I have used:
MinMeanSEMMax <- function(x) {
v <- c(min(x),
mean(x) - sd(x)/sqrt(length(x)),
mean(x),
mean(x) + sd(x)/sqrt(length(x)),
max(x))
names(v) <- c("ymin", "lower", "middle", "upper", "ymax")
v
}
p <- ggplot(Combined_Baseline_DataIL1beta,
aes(x=Diagnosis, y=Nonaffected_Ileum, color=Diagnosis)) +
stat_summary(fun.data = MinMeanSEMMax, geom = "boxplot") +
geom_jitter(shape=16, position=position_jitter(0.2)) +
stat_boxplot(geom = 'errorbar') +
ggtitle("Number of IL-1 beta positive cells in the non-affected ileum") +
ylab("Number of IL-1 beta positive cells per mm2")
p
Does anyone have some advice?
question from:
https://stackoverflow.com/questions/65844242/boxplot-wih-wrong-whiskers-line-until-ymax-and-ymin 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…