-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add separate keyword argument dictionaries for components of boxenplot #2909
Conversation
Removed `kwargs` which were used to draw the median lines and scatter plot of outliers previously. Added separate kwargs - `box_kws`, `line_kws` (drawing the median lines) and `flier_kws` (for the scatter of outliers). Updated the matching docstring.
…reformatted. Here it is reverted and only the changes to `seaborn.categorical.boxenplot` and `seaborn.categorical._LVPlotter` are kept.
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.
Thanks @EitanHemed for taking a crack at this. The logic looks right to me; I have a number of comments that are mostly cosmetic.
The comments about the boxenplot
docstring are critical though and I am wondering how those changes ended up in here ... are you using some kind of automated formatting tool that introduced them? If so, that tools seems broken.
More importantly, could you please add a test to cover this new behavior? Thanks.
seaborn/categorical.py
Outdated
# Set the default kwargs for the boxes | ||
box_default_kws = dict(cmap=cmap, | ||
edgecolor=self.gray, | ||
linewidth=self.linewidth) | ||
|
||
for k, v in box_default_kws.items(): | ||
box_kws.setdefault(k, v) |
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.
I would move this up to where you handle the other defaults / custom kwargs.
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.
I moved most of it upwards, but kept the cmap
argument below, as it is only being assigned on this part of the function.
cmap
itself cannot be easily moved upwards, as it relies on rgb
, which relies on hex_color
.
- Removed commented out code in the `plot` function
Disentangled the nested for loop for default kwargs assignment
…only a single data point.
Two current issues (a) most are not testing when multiple categories are used on the x-axis, but only a single one. (b) the tests for the box_kws functionality are very slim.
* Sorting boxenplot * Boxenplot separate kws Removed `kwargs` which were used to draw the median lines and scatter plot of outliers previously. Added separate kwargs - `box_kws`, `line_kws` (drawing the median lines) and `flier_kws` (for the scatter of outliers). Updated the matching docstring. * In the previous commit most code on the categorical.py file was auto-reformatted. Here it is reverted and only the changes to `seaborn.categorical.boxenplot` and `seaborn.categorical._LVPlotter` are kept. * Reinserted blank lines in docstring. * - Removed redundant indention in `boxenplot` function - Removed commented out code in the `plot` function * Removed default kwargs from `plot` * Removing commented out code * Reverted to ternary expressions * Replaced default kwargs assignment to box_kws Disentangled the nested for loop for default kwargs assignment * Removed remaining `kwargs` item in docstring * Resolved incorrect reference in the box_kws item on the docstring. * Resolved incorrect descriptions for box_kws, line_kws and flier_kws. * Changed line_kws update to source arguments frmo box_kws if there is only a single data point. * Added line_kws test * Added flier_kws test, renamed line_kws test * Tests - further work is required in expanding the tests. Two current issues (a) most are not testing when multiple categories are used on the x-axis, but only a single one. (b) the tests for the box_kws functionality are very slim. * Fix lint issues * Fix pinned tests * Update release notes * Cleanup boxenplot colors test Co-authored-by: EitanHemed <[email protected]>
Thanks @EitanHemed I took care of the final touches (fixing the lint errors and test failures on pinned versions) so that this could make it into the release candidate. |
@mwaskom great, thanks! |
Aiming to solve issue #2701 - adding separate keyword support for
boxenplot
.Changes -
Removed
kwargs
which were used to draw the median lines and scatter plot of outliers previously.Added separate kwargs -
box_kws
,line_kws
(drawing the median lines) andflier_kws
(for the scatter of outliers).Updated the matching docstring.
Passed all relevant tests.
Closes #2701