I need to indicate the number of samples in geometric boxplot for each plot when you have several plots per one x variable. In other words, my x axis has two variables and I have three boxplots for each.
ggplot(data, aes(x = Genotype, y = Angle, fill = NULL)) +
geom_boxplot(color="black", alpha=0.9, outlier.shape = NA) +
labs(x = NULL, y ="Angle [°]") +
theme(axis.text.y = element_text(color = "black", size = 12)) +
theme(axis.text.x = element_text(color = "black", size = 12)) +
scale_x_discrete(limits = c("DMSO", "chemical")) +
theme(text = element_text(size = 12)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1, face = "italic")) +
ylim(-40,120) +
geom_jitter(position=position_jitter(0.1), alpha = 1, size = 1, shape = 1) +
I have omitted unnecessary part of the code for the sake of clarity.
So, simply put, I would like to indicate number of samples per each plot individually. Any idea?
Thanks.
I tried stat_n_text(y.pos = -10, color = "black", size = 3)
, but it only shows pooled number of samples per each x (i.e. DMSO and chemical in my example).