FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Backport PR #24167 on branch v3.6.x (FIX: turn off layout engine tightbbox) by meeseeksmachine · Pull Request #24176 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .png  (1) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ def print_figure(
_bbox_inches_restore = None

# we have already done layout above, so turn it off:
stack.enter_context(self.figure._cm_set(layout_engine=None))
stack.enter_context(self.figure._cm_set(layout_engine='none'))
try:
# _get_renderer may change the figure dpi (as vector formats
# force the figure dpi to 72), so we need to set it again here.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_bbox_tight.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,13 @@ def test_noop_tight_bbox():
assert (im[:, :, 3] == 255).all()
assert not (im[:, :, :3] == 255).all()
assert im.shape == (7, 10, 4)


@image_comparison(['bbox_inches_fixed_aspect'], extensions=['png'],
remove_text=True, savefig_kwarg={'bbox_inches': 'tight'})
def test_bbox_inches_fixed_aspect():
with plt.rc_context({'figure.constrained_layout.use': True}):
fig, ax = plt.subplots()
ax.plot([0, 1])
ax.set_xlim(0, 1)
ax.set_aspect('equal')

Back | FazBrowse Home | New Git URL