-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Fix support for matplotlib's constrained_layout (#25261) #39394
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
ENH: Fix support for matplotlib's constrained_layout (#25261) #39394
Conversation
mdruiter
commented
Jan 25, 2021
•
edited
Loading
edited
- closes plotting: subplots_adjust prevents use of constrained_layout=True #25261
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
The failing tests seem totally unrelated!? |
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.
pls add the test from the OP
@@ -227,7 +227,8 @@ def _grouped_plot_by_column( | |||
|
|||
byline = by[0] if len(by) == 1 else by | |||
fig.suptitle(f"Boxplot grouped by {byline}") | |||
fig.subplots_adjust(bottom=0.15, top=0.9, left=0.1, right=0.9, wspace=0.2) | |||
if not hasattr(fig, "get_constrained_layout") or not fig.get_constrained_layout(): |
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.
make a function for this
maybe_adjust_figure or similar
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.
Done. Hope this is what you had in mind.
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -341,7 +341,7 @@ Plotting | |||
^^^^^^^^ | |||
|
|||
- Bug in :func:`scatter_matrix` raising when 2d ``ax`` argument passed (:issue:`16253`) | |||
- | |||
- Support matplotlib's ``constrained_layout=True`` (:issue:`25261`) |
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.
can you be slightly more verbose here. this allows passing this option right?
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 change just prevents pandas from doing incompatible things when a figure has constrained_layout enabled.
…atplotlib_s_constrained_layout_25261
thanks @mdruiter very nice! |