Skip to content
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

Closed
wants to merge 16 commits into from

Conversation

EitanHemed
Copy link
Contributor

@EitanHemed EitanHemed commented Jul 15, 2022

Aiming to solve issue #2701 - adding separate keyword support for boxenplot.

Changes -

  1. Removed kwargs which were used to draw the median lines and scatter plot of outliers previously.

  2. Added separate kwargs - box_kws, line_kws (drawing the median lines) and flier_kws (for the scatter of outliers).

  3. Updated the matching docstring.

Passed all relevant tests.

Closes #2701

EitanHemed and others added 3 commits July 8, 2022 20:54
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.
Copy link
Owner

@mwaskom mwaskom left a 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.

Comment on lines 1962 to 1968
# 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)
Copy link
Owner

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.

Copy link
Contributor Author

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.

@mwaskom mwaskom changed the title Boxenplot kws enhance Add separate keyword argument dictionaries for components of boxenplot Jul 19, 2022
@mwaskom mwaskom mentioned this pull request Aug 13, 2022
mwaskom added a commit that referenced this pull request Aug 13, 2022
* 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]>
@mwaskom
Copy link
Owner

mwaskom commented Aug 13, 2022

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 mwaskom mentioned this pull request Aug 13, 2022
@EitanHemed
Copy link
Contributor Author

@mwaskom great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boxenplot fliersize ?
2 participants