I would like to add single reference values to each of my half violins.
It should look something like this with a shape:
Here is the code for my current plot (first img):
ggplot(data = csi, aes(x=species,y=CSI, fill=time))+
geom_split_violin(stat = "ydensity", trim = T,scale = "width")+
scale_fill_manual(values=c("grey40","grey60"))+
theme(axis.text.x=element_text(angle=35,hjust = 1))
And this is how my dataset looks like:
str(csi)
'data.frame': 265196 obs. of 3 variables:
$ species: Factor w/ 17 levels "Tilia europaea",..: 8 8 8 8 8 8 8 8 8 8 ...
$ time : Factor w/ 2 levels "present","future": 1 1 1 1 1 1 1 1 1 1 ...
$ CSI : num 0.395 0.66 0.615 0.612 0.808 ...
head(csi)
species time CSI
1 Acer platanoides present 0.3953996
2 Acer platanoides present 0.6603609
3 Acer platanoides present 0.6148618
...
I have an additional dataframe with the values per species and time I'd like to add to my plot:
species time mean
1 Acer platanoides present 0.7069132
2 Acer platanoides future 0.4984167
3 Acer rubrum present 0.2257700
4 Acer rubrum future 0.1622086
...
How can I achieve this? Thanks in advance and best regards