-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Boxplot: Median line too long after changing linewidth #19409
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
Comments
A symptomatic workaround for the overlapping issue would be to change zdelta = 0.1 in this line to zdelta = - 0.1 That resolves it for me. As far as I can see, |
There are different cap styles for solid lines and dashed lines. This is also a case where the re-scaling of the dash pattern with linewidth is not an improvement... |
Should be a first good issue: change the default cap style and the zorder. Problems may involve testing. |
I would like to make a small contribution in order to fix this issue. The solution has already been hinted above. This would be my first contribution and I am not quite clear on what is expected when testing the fix. |
Where are these defined? Maybe changing the default cap style would help. |
Nevermind, found it in |
Closes #19409. - Set the default capstyles (solid and dashed) for median and mean lines in boxplots to "butt". I also modieifed the behaviror for setting the capstyle for median lines to obey the user's preference instead of overriding it. - The boxplot PDFs were using the wrong capstyle, so I modified the references to use the butt captyle. - Fixed a small typo in `bxp()` - Added a new test for the median line (from PR #23335) Co-authored-by: Elliott Sales de Andrade <[email protected]>
When changing the
linewidth
property of the median line in boxplots, the line will extend beyond the box width.For example,
gives (on Matplotlib 3.2.2):

By simply chaning the
solid_capstyle
propery to"butt"
inI was able to improve this a bit (I stole that trick from here):

Ideally, one could now reduce the median line length such that it no longer overlaps with the black bounding line of the box.
Since the box line width is only accessible in "points" units, it would need to be transformed to data units.
I was unable to get this to work, though.
Would it be possible/desirable to change the default setting for
solid_capstyle
?Could this be handled in a different way?
The text was updated successfully, but these errors were encountered: