Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addorientation parameter to Boxplot and deprecatevert#28074

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rcomer merged 3 commits intomatplotlib:mainfromsaranti:boxplot_vert
May 15, 2024

Conversation

saranti
Copy link
Contributor

@sarantisaranti commentedApr 14, 2024
edited
Loading

PR summary

Closes#13435 together with PR#27998.
Replace the vert: bool parameter with orientation : {'vertical', 'horizontal'}. Changes are very similar to the work done on#27998 and most of it works interchangeably.

PR checklist

Copy link
Member

@oscargusoscargus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Will only leave comments for now, but in general looks OK once the tests are passing.

  1. Replacevert withorientation in the failing tests (you have added a similarity test for the transition period, so makes sense to update the old ones)
  2. Not sure how the discussion w.r.t. the rcParam went, but I think it makes sense to deprecate that as well. Not sure what the path is there though...boxplot.vertical

saranti reacted with thumbs up emoji
@sarantisaranti marked this pull request as draftApril 16, 2024 11:49
@sarantisaranti marked this pull request as ready for reviewApril 17, 2024 11:36
@saranti
Copy link
ContributorAuthor

That test is passing on my end, I don't know what the problem is 🤔

@rcomer
Copy link
Member

rcomer commentedApr 27, 2024
edited
Loading

Looks like the test just timed out. Let’s see if a re-spin helps…

Edit: apparently not.

@saranti
Copy link
ContributorAuthor

  • Nowvert=True won't emit a deprecation warning, regardless of how it's set. It also won't overrideorientation.

  • vert=False will emit a deprecation warning and overrideorientation.

  • Settingmpl.rcParams['boxplot.vertical'] to False will trigger an rcparam deprecation warning.

@sarantisarantiforce-pushed theboxplot_vert branch 3 times, most recently frombdcfc97 to3bc3735CompareMay 7, 2024 09:19
Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Modulo two documentation suggestions.

Thanks@saranti!

Copy link
Member

@rcomerrcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks@saranti, this is looking great!

It took me a while to get my head around why we are not warning whenvert=True is explicitly passed. I guess it's because it's too complicated to do forbxp as we can't tell whether it came from the rcParam. However would it be worth adding an extra warning inboxplotspecifically for whenvert=True? Apologies if I've missed some discussion on this somewhere.

saranti reacted with thumbs up emoji
@@ -3155,7 +3155,7 @@ def _bxp_test_helper(
logstats = mpl.cbook.boxplot_stats(
np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs)
fig, ax = plt.subplots()
if bxp_kwargs.get('vert', True):
ifnotbxp_kwargs.get('orientation') or bxp_kwargs.get('orientation') == 'vertical':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
ifnotbxp_kwargs.get('orientation')orbxp_kwargs.get('orientation')=='vertical':
ifbxp_kwargs.get('orientation','vertical')=='vertical':

Defines a default and so avoids callingget twice.

saranti reacted with thumbs up emoji
@timhoffm
Copy link
Member

Thanks@saranti, this is looking great!

It took me a while to get my head around why we are not warning whenvert=True is explicitly passed. I guess it's because it's too complicated to do forbxp as we can't tell whether it came from the rcParam. However would it be worth adding an extra warning inboxplotspecifically for whenvert=True? Apologies if I've missed some discussion on this somewhere.

Good catch. Since we have the tri-state True/False/None, we can detect whenever True/False was passed explicitly. If we push rcParams resolution down tobxp() we can even detect that also forbxp().

@rcomer
Copy link
Member

If we push rcParams resolution down to bxp() we can even detect that also for bxp().

That would mean the rcParam affects cases where the user callsbxp directly, which it didn’t before. However I think it’s a little odd that it didn’t, so we could consider that a bugfix 🤔

@rcomer
Copy link
Member

Could we also set the rcParam in the default matplotlibrc toNone and then add it to this dictionary (highlighted by@QuLogic above)?

_deprecated_remain_as_none= {}

If I have understood, that would mean we get the warning if the rcParam is explicitly set to eitherTrue orFalse by the user.

@timhoffm
Copy link
Member

timhoffm commentedMay 12, 2024
edited
Loading

If we push rcParams resolution down to bxp() we can even detect that also for bxp().

That would mean the rcParam affects cases where the user callsbxp directly, which it didn’t before. However I think it’s a little odd that it didn’t, so we could consider that a bugfix 🤔

Indeed. But it would only affectbxp() calls, wherevert is not passedand the rcParam is modified. I'd be willing to accept that change because being able to warn on all explicitbxp(..., vert=) is IMHO more important. And as you say, it can be considered a bugfix. And the rcParam gets deprecated, so the user has to adapt their code anyway.

Re rcParam None: I have not been able / spent enough time to fully understand the mechanics (see#28074 (comment)) but the solution there to warn on rcParam readout seems good enough. We only don't warn if you configure the rcParam explicitly to True (but why would one do that when it's the default behavior anyway).

rcomer reacted with thumbs up emoji

@saranti
Copy link
ContributorAuthor

I didn't see any reason why thevert = mpl.rcParams['boxplot.vertical'] needed to be inboxplot so I moved it tobxp. Now it also gives a warning tobxp calls where it previously didn't.
Explicitly settingvert=True will now also emit a deprecation warning.

@sarantisarantiforce-pushed theboxplot_vert branch 2 times, most recently fromca45848 to0f7a522CompareMay 14, 2024 13:14
@rcomerrcomer merged commit70a36e2 intomatplotlib:mainMay 15, 2024
43 of 44 checks passed
@sarantisaranti deleted the boxplot_vert branchMay 15, 2024 07:25
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@oscargusoscargusoscargus left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@rcomerrcomerrcomer approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.10.0
Development

Successfully merging this pull request may close these issues.

boxplot/violinplot orientation-setting API
5 participants
@saranti@rcomer@timhoffm@QuLogic@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp