Skip to content

Commit 5e2bf2c

Browse files
committed
Backport PR #24783: inset locator fix with tests added
1 parent 49aa465 commit 5e2bf2c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __call__(self, ax, renderer):
7878

7979
px, py = self.get_offset(width, height, 0, 0, renderer)
8080
bbox_canvas = Bbox.from_bounds(px, py, width, height)
81-
tr = ax.figure.transFigure.inverted()
81+
tr = ax.figure.transSubfigure.inverted()
8282
bb = TransformedBbox(bbox_canvas, tr)
8383

8484
return bb

lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,3 +579,23 @@ def test_removal():
579579
fig.canvas.draw()
580580
col.remove()
581581
fig.canvas.draw()
582+
583+
584+
@image_comparison(['anchored_locator_base_call.png'], style="mpl20")
585+
def test_anchored_locator_base_call():
586+
fig = plt.figure(figsize=(3, 3))
587+
fig1, fig2 = fig.subfigures(nrows=2, ncols=1)
588+
589+
ax = fig1.subplots()
590+
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))
591+
ax.set(xticks=[], yticks=[])
592+
593+
Z = cbook.get_sample_data(
594+
"axes_grid/bivariate_normal.npy", np_load=True
595+
)
596+
extent = (-3, 4, -4, 3)
597+
598+
axins = zoomed_inset_axes(ax, zoom=2, loc="upper left")
599+
axins.set(xticks=[], yticks=[])
600+
601+
axins.imshow(Z, extent=extent, origin="lower")

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