Add orientation parameter to Boxplot and deprecate vert#28074
Conversation
oscargus
left a comment
There was a problem hiding this comment.
Will only leave comments for now, but in general looks OK once the tests are passing.
- Replace
vertwithorientationin the failing tests (you have added a similarity test for the transition period, so makes sense to update the old ones) - 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
|
That test is passing on my end, I don't know what the problem is 🤔 |
|
Looks like the test just timed out. Let’s see if a re-spin helps… Edit: apparently not. |
|
bdcfc97 to
3bc3735
Compare
rcomer
left a comment
There was a problem hiding this comment.
Thanks @saranti, this is looking great!
It took me a while to get my head around why we are not warning when vert=True is explicitly passed. I guess it's because it's too complicated to do for bxp as we can't tell whether it came from the rcParam. However would it be worth adding an extra warning in boxplotspecifically for when vert=True? Apologies if I've missed some discussion on this somewhere.
| np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs) | ||
| fig, ax = plt.subplots() | ||
| if bxp_kwargs.get('vert', True): | ||
| if not bxp_kwargs.get('orientation') or bxp_kwargs.get('orientation') == 'vertical': |
There was a problem hiding this comment.
| if not bxp_kwargs.get('orientation') or bxp_kwargs.get('orientation') == 'vertical': | |
| if bxp_kwargs.get('orientation', 'vertical') == 'vertical': |
Defines a default and so avoids calling get twice.
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 to |
That would mean the rcParam affects cases where the user calls |
|
Could we also set the rcParam in the default matplotlibrc to matplotlib/lib/matplotlib/__init__.py Line 646 in 46b39ab If I have understood, that would mean we get the warning if the rcParam is explicitly set to either |
Indeed. But it would only affect 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). |
|
I didn't see any reason why the |
ca45848 to
0f7a522
Compare
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