Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 845b22a

Browse files
committed
inset locator fix with tests added
added remove_text to image comparison decorator Co-authored-by: Oscar Gustafsson <[email protected]> removed inaccurate comments Co-authored-by: Oscar Gustafsson <[email protected]> removed text from test image and test Update lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py changed subfigure generation to default Co-authored-by: Elliott Sales de Andrade <[email protected]> got rid of colorbar removed colorbar and changed test image
1 parent 65dc9be commit 845b22a

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
@@ -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

Lines 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)