-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Better default behavior for boxplots when rcParams['lines.marker'] is set #15798
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
Conversation
|
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.
The function is called for flierprops
:
final_flierprops = line_props_with_rcdefaults(
'flierprops', flierprops)
I think we need
8000
a distinction that the marker is not overridden in that case. Could be passed as a parameter no_marker=True
.
To check my understanding, this is needed not because the marker is set by those methods, but because it is implicitly pulled in by one of the lower-level artists we use to make the box plot. By explicitly setting marker to This definitely needs a test given how distributed these issues are (needing to adjust an internal helper function to control the default behavior of classes someplace else in the code base). Thanks for your work @pharshalp . |
thanks for your comments @timhoffm and @tacaswell. Will finish this
(including a test) in a day or two.
…On Wed, Dec 4, 2019 at 11:29 PM Thomas A Caswell ***@***.***> wrote:
To check my understanding, this is needed not because the marker is set by
those methods, but because it is implicitly pulled in by one of the
lower-level artists we use to make the box plot. By explicitly setting
marker to '' we defeat that behavior?
This definitely needs a test given how distributed these issues are
(needing to adjust an internal helper function to control the default
behavior of classes someplace else in the code base).
Thanks for your work @pharshalp <https://github.com/pharshalp> .
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15798?email_source=notifications&email_token=ADTY7RAEEC2QAD4SQ3YCUQDQXB7Q3A5CNFSM4JTH4SC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF7OEFY#issuecomment-561963543>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADTY7RGO3VQ3FXCU5RRVKNLQXB7Q3ANCNFSM4JTH4SCQ>
.
|
@timhoffm implemented your suggestion of adding a parameter |
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.
Essentially good to go. I'd just invert the logic of the marker flag.
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.
Should be squashed before merging.
pheww... done! (Out of habit, I had merged the current master into my branch. This introduced irrelevant changes to this PR. All ok now!). |
…rs showing up on boxplots. added a test.
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.
Do you test the kwarg?
test_data = np.arange(100) | ||
test_data[-1] = 150 # a flier point | ||
bxp_handle = ax.boxplot(test_data, showmeans=True) | ||
for bxp_lines in ['whiskers', 'caps', 'boxes', 'medians']: |
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.
Do you test the kwarg?
@jklymak yes, it gets checked (for 'whiskers', 'caps', 'boxes', 'medians') when the line markers are forced to ''
irrespective of what the rcParams['lines.marker']
says (explicitly set to 's'
in this test). [This implicitly tests use_marker=False
].
for bxp_lines in ['whiskers', 'caps', 'boxes', 'medians']:
for each_line in bxp_handle[bxp_lines]:
# Ensure that the rcParams['lines.marker'] is overridden by ''
assert each_line.get_marker() == ''
I am also checking that the markers are allowed for fliers
and means
(and not forced to ''
). [This implicitly tests use_marker=True
].
# Ensure that markers for fliers and means aren't overridden with ''
assert bxp_handle['fliers'][0].get_marker() == 'o'
assert bxp_handle['means'][0].get_marker() == '^'
Thanks for the contribution! |
Thanks all for the helpful review! |
PR Summary
closes #15730
avoid using rcParams['lines.marker'] for boxplots.
Code snippet for reproducing the issue:
Before this PR:

After this PR:

PR Checklist