Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3aa5746

Browse filesBrowse files
dstansbymeeseeksmachine
authored andcommitted
Backport PR #24783: inset locator fix with tests added
1 parent 95086b1 commit 3aa5746
Copy full SHA for 3aa5746

File tree

Expand file treeCollapse file tree

3 files changed

+21
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-1
lines changed

‎lib/mpl_toolkits/axes_grid1/inset_locator.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/inset_locator.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __call__(self, ax, renderer):
7373
bbox = self.get_window_extent(renderer)
7474
px, py = self.get_offset(bbox.width, bbox.height, 0, 0, renderer)
7575
bbox_canvas = Bbox.from_bounds(px, py, bbox.width, bbox.height)
76-
tr = ax.figure.transFigure.inverted()
76+
tr = ax.figure.transSubfigure.inverted()
7777
return TransformedBbox(bbox_canvas, tr)
7878

7979

‎lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,3 +716,23 @@ def test_removal():
716716
fig.canvas.draw()
717717
col.remove()
718718
fig.canvas.draw()
719+
720+
721+
@image_comparison(['anchored_locator_base_call.png'], style="mpl20")
722+
def test_anchored_locator_base_call():
723+
fig = plt.figure(figsize=(3, 3))
724+
fig1, fig2 = fig.subfigures(nrows=2, ncols=1)
725+
726+
ax = fig1.subplots()
727+
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))
728+
ax.set(xticks=[], yticks=[])
729+
730+
Z = cbook.get_sample_data(
731+
"axes_grid/bivariate_normal.npy", np_load=True
732+
)
733+
extent = (-3, 4, -4, 3)
734+
735+
axins = zoomed_inset_axes(ax, zoom=2, loc="upper left")
736+
axins.set(xticks=[], yticks=[])
737+
738+
axins.imshow(Z, extent=extent, origin="lower")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.