[R] boxplot notch
sibyiie@stoeckii m@iii@g oii gmx@ch
sibyiie@stoeckii m@iii@g oii gmx@ch
Fri Aug 16 15:24:39 CEST 2024
Dear community
I tried the following code using geom_boxplot() and notch=TRUE. Does anyone
know if the command �notch=TRUE� is at the wrong place in my special code
construct?
Without notch=TRUE the code provides the planned ggplot.
Kind regards
Sibylle
Code:
MS1<- MS %>% filter(QI_A!="NA") %>% droplevels()
MS1$Jahr<-as.factor(MS1$Jahr)
MS1s <- MS1 %>%
group_by(MS1$Jahr, MS1$Bio) %>%
summarise(
y0 = quantile(QI_A, 0.05),
y25 = quantile(QI_A, 0.25),
y50 = mean(QI_A),
y75 = quantile(QI_A, 0.75),
y100 = quantile(QI_A, 0.95))
MS1s
colnames(MS1s)[1]<-"Jahr"
colnames(MS1s)[2]<-"Bio"
MS1s
p1<-ggplot(MS1s, aes(Jahr, fill = as.factor(Bio))) +
geom_boxplot(
aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
stat = "identity", notch=TRUE
) +
theme(panel.background = element_blank())+
theme(axis.line = element_line(colour = "black"))+
theme(axis.text=element_text(size=18))+
theme(axis.title=element_text(size=20))+
ylab("Anteil BFF an LN [%]") +xlab("Jahr")+
scale_color_manual(values=c("red","darkgreen"), labels=c("�LN", "BIO"))+
scale_fill_manual(values=c("red","darkgreen"), labels= c("�LN", "BIO"))+
theme(legend.title = element_blank())+
theme(legend.text=element_text(size=20))
p1<-p1 + expand_limits(y=c(0, 80))
p1
[[alternative HTML version deleted]]
More information about the R-help
mailing list