-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Boxplot: Median line is now bound within the box for all linewidths #23335
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3991,7 +3991,13 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True, | |
if zorder is None: | ||
zorder = mlines.Line2D.zorder | ||
|
||
zdelta = 0.1 | ||
# Use 'butt' as the default capstyle to avoid a visual overlap of | ||
# the median line and the boxplot | ||
if medianprops.get('solid_capstyle') is None: | ||
medianprops['solid_capstyle'] = 'butt' | ||
|
||
# put the mean and median line below the box for visual improvement | ||
zdelta = -0.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this lead to that the lines disappear if the box is colored? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right. The lines disappear due to the change of the zdelta. I am not sure what the intended result should be. As you described (#19409 (comment)), the mean and median lines have a different cap style. How should the desired result look? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My comment there did clearly not take filled boxes into account... I think that is really the main problem here: what should it look like? I've googled a bit and there seems to be no real consensus if the lines should extend in a certain way. Anyway, I guess that there are two options here:
So probably just reverting the zorder change is enough. If you can provide an image of the results (e..g using any of the examples in #19409, possibly with exaggerated line widths), that would simplify the review. (Just paste it in a comment.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would actually strongly consider an image test here so we can codify what this should look like. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the detailed answer. I will go with option 1 then. |
||
|
||
def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True): | ||
d = {k.split('.')[-1]: v for k, v in rcParams.items() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing the test failure. Also, providing a default option for get avoid an error in case the element is not there.