Reputation: 11
Is there a way of having multiple median lines within a boxplot for individual subgroups? Probably not clear from the code but I have jitters to show all datapoints of four "methods" and in addition would like a line corresponding to each method withing the boxplot. I have tried stat_summary but this just connects the medians using a line.
ggplot(df, aes(x = IS, y = value))+
geom_boxplot(aes(group=IS), outliers = FALSE)+
stat_boxplot(geom = "errorbar", width = 0.2)+
geom_jitter(aes(shape=Type, colour = Type), position = position_jitter(width=0.2))+
scale_shape_manual(values = box_shapes)+
scale_color_manual(values= box_cols)+
theme_minimal()+
labs(x = "IS", y = "Concentration")+
theme(panel.grid = element_blank(),
axis.title = element_text(face = "bold"),
axis.line = element_line(colour = "black"),
axis.ticks.y = element_line(colour = "black"),
axis.text = element_text(face = "bold"))
Upvotes: 0
Views: 41