Let's say we observed two species of beetles. We want to compare their size using geom_violin() as done below:
df = data.frame(species=rep(c('species_a','species_b'),3), size=c(1,1.5,1.2,1.8,1.1,1.9))
ggplot(df, aes(x=species, y=size)) + geom_violin()
Knowing that the expected size range is [0.8,1.8] for species_a and [1.2, 1.8] for species_b...
ranges = list(species_a=c(0.8,1.8), species_b=c(1.2,1.8))
How can we easily add this range (with a grey shape for example) on the graph?