Skip to content

Commit 49f9ab8

Browse files
authored
Merge pull request #26291 from ksunden/inset_renderer
2 parents fa68f46 + dae0cc2 commit 49f9ab8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def draw(self, renderer):
6969
raise RuntimeError("No draw method should be called")
7070

7171
def __call__(self, ax, renderer):
72+
if renderer is None:
73+
renderer = ax.figure._get_renderer()
7274
self.axes = ax
7375
bbox = self.get_window_extent(renderer)
7476
px, py = self.get_offset(bbox.width, bbox.height, 0, 0, renderer)

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from itertools import product
2+
import io
23
import platform
34

45
import matplotlib as mpl
@@ -247,6 +248,15 @@ def test_inset_axes_complete():
247248
bbox_transform=ax.transAxes)
248249

249250

251+
def test_inset_axes_tight():
252+
# gh-26287 found that inset_axes raised with bbox_inches=tight
253+
fig, ax = plt.subplots()
254+
inset_axes(ax, width=1.3, height=0.9)
255+
256+
f = io.BytesIO()
257+
fig.savefig(f, bbox_inches="tight")
258+
259+
250260
@image_comparison(['fill_facecolor.png'], remove_text=True, style='mpl20')
251261
def test_fill_facecolor():
252262
fig, ax = plt.subplots(1, 5)

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