Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wildetudor opened this issue Feb 3, 2021 · 1 comment

Comments

@wildetudor
Copy link

wildetudor commented Feb 3, 2021

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!

@piermorel
Copy link
Owner

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 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants