I try to mark my graphs with the average specific of each graph :
ggplot(diamonds, aes(x = carat, fill=cut)) +
stat_density(aes(ymax = ..density.., ymin = -..density..),
geom = "ribbon", position = "identity") +
facet_grid(. ~ cut) +
xlim(0,2.5) +
geom_text(data = NULL, x = 0.6, y = 0, label = mean(carat), size=5) +
coord_flip()
For example, here I would like the graph of "Fair" is displayed average of "Fair", that of "Good" is displayed average of "Good", etc.
Also, but this is an extra, I would like to be positioned with respect to x if the average is 1.0, while the average is displayed at x = 1.0
