gramm icon indicating copy to clipboard operation
gramm copied to clipboard

Median & quartile lines to extend all the way to the edges of violin plot?

Open wildetudor opened this issue 4 years ago • 1 comments

I'm trying to create mixed violin&box plots where, rather than be of fixed width (as gramm's stat_boxplot makes them), both the median line and the quartile lines above/below it extend all the way to the edge of the violin plot. Just like in the image below: mehr 2018 currbio (made with R)

I know that in ggplot2, this is done easily straight from geom_violin (cf documentation; search "# Show quartiles").

In gramm, I think rather than tweak stat_violin.m, it's easier to achieve this by playing around with the width of the bars that stat_boxplot adds. However, I've not been able to achieve the desired effect. ANy suggestions? Thanks!

wildetudor avatar Feb 03 '21 18:02 wildetudor

Hi @wildetudor, Thanks for the idea. I don't know if you are still looking into this (as you can see after a long hiatus I have the opportunity to make the repository more alive !), but I suspect that it might be easier to do this by tweaking stat_violin(). Since graphic elements work quite independently from each other it would be quite hard to get stat_boxplot to know about the width of violins. It's much easier to recalculate medians and quartiles within stat_violin and plot them there. Hoping to see a pull request on this 😉

piermorel avatar Jan 17 '24 15:01 piermorel