I have build a boxplot with ggplot and want to display the actual values of the 1st quartile, median and 3rd quartile in the boxplot.
Since the boxplot already shows the 1st quartile, median and 3rd wuartile, I would assume there is a simple function to dispaly the values in the boxplot itself. These are my current codes:
CAGR <- ggplot(datalong5, aes(x = Year, y = value, fill = new)) +
geom_boxplot(outlier.shape = NA, coef = 0) +
coord_cartesian(ylim = c(-0.1, 0.2)) +
scale_fill_discrete(name = "") +
theme(axis.title.x = element_blank()) +
theme(axis.title.y = element_blank())
CAGR +
scale_y_continuous(labels = percent, breaks = seq(-0.1, 0.3, by = 0.05)) +
scale_fill_discrete(name = "Forklaring") +
theme(legend.position = c(0.85, 0.15)) +
theme(axis.text = element_text(size = 12, colour = "black"))
I have tried the stat_summary function(fun = median), but that does not seem to work for me since it only displays the median as a "point", but I want the value itself. Thanks in advance.