Skip to content

Commit 83157ee

Browse files
committed
FIX: turn off layout engine tightbbox
1 parent 1f9dc78 commit 83157ee

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,7 @@ def print_figure(
23312331
_bbox_inches_restore = None
23322332

23332333
# we have already done layout above, so turn it off:
2334-
stack.enter_context(self.figure._cm_set(layout_engine=None))
2334+
stack.enter_context(self.figure._cm_set(layout_engine='none'))
23352335
try:
23362336
# _get_renderer may change the figure dpi (as vector formats
23372337
# force the figure dpi to 72), so we need to set it again here.

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,13 @@ def test_noop_tight_bbox():
146146
assert (im[:, :, 3] == 255).all()
147147
assert not (im[:, :, :3] == 255).all()
148148
assert im.shape == (7, 10, 4)
149+
150+
151+
@image_comparison(['bbox_inches_fixed_aspect'], extensions=['png'],
152+
remove_text=True, savefig_kwarg={'bbox_inches': 'tight'})
153+
def test_bbox_inches_fixed_aspect():
154+
with plt.rc_context({'figure.constrained_layout.use': True}):
155+
fig, ax = plt.subplots()
156+
ax.plot([0, 1])
157+
ax.set_xlim(0, 1)
158+
ax.set_aspect('equal')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy