Median and quartile on violin plots in ggplot2

前端 未结 3 588
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 05:48

I would like to draw some violin plots with ggplot2, but I noticed that median and first and third quartile are not automatically displayed. I believe these plots would be m

3条回答
  •  旧巷少年郎
    2020-12-29 06:18

    One way to do this is to just put a thin box plot over the top of it. Here's an example with the iris data:

    require(ggplot2)
    ggplot(iris,aes(Species,Sepal.Length))+geom_violin()+geom_boxplot(width=.1)
    

    enter image description here

提交回复
热议问题