quantiles drawn by geom_violin's draw_quantiles option are incorrect
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization
Research direction
Start by reproducing the provided Python example using geom_violin(draw_quantiles=[0.25, 0.5, 0.75]) and the overlaid geom_boxplot. Trace the geom_violin draw_quantiles behavior and compare its lines with the grouped-data 25%, 50%, and 75% values. Done means the violin quantile lines align with the corresponding statistical quantiles, including the median.
Written by the indexing model from the issue text.
Description
The quantiles drawn by geom_violin are incorrect e.g. the 50% quantile does not correspond to the median. A simple example, where a boxplot is overlayed to show the expected position of the 25, 50 and 75% quantiles:
from plotnine import *
import pandas as pd
import numpy as np
df = pd.DataFrame({
"y": np.random.gamma(1,2,10),
"x": ["a"]*10
})
plt = (
ggplot(df, aes(x="x", y="y")) +
geom_violin(draw_quantiles=[0.25,0.5,0.75]) +
geom_boxplot(alpha=0.5,width=0.1,fill="grey")
)
plt.show()
Plotting the mean and median for comparison:
plt = (
ggplot(df, aes(x="x", y="y")) +
geom_violin(draw_quantiles=0.5) +
geom_hline(data=df.groupby(["x"])["y"].describe(), mapping=aes(yintercept="mean"), color="red",alpha=0.5) +
geom_hline(data=df.groupby(["x"])["y"].describe(), mapping=aes(yintercept="50%"), color="blue",alpha=0.5)
)
plt.show()
Tested with plotnine-0.13.6 and Python 3.10
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 269
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from has2k1/plotnine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Feature request: add rotation_mode param to geom_textPossibly taken A pull request linked to this issue is open or already merged. OpenFeature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
position_dodge2() leaves nested rectangles overlappingPossibly taken @MahnoorAhmed999 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Enhancement
Difficulty 3/5 Half a day Newbie friendliness 55/100
-
Enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
plone/plone.observability#114 ·
Maintainers usually reply within 1 day
-
area:docs type:docs
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jejjohnson/gauss_flows#246 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openvax/varcode#824 · 1 comment ·
Maintainers usually reply within 1 day
-
netbox status: needs triage type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
netbox-community/netbox#23868 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
emeryberger/CSrankings#15757 ·
Maintainers usually reply within 9 days