Skip to content

Commit

Permalink
inset locator fix with tests added
Browse files Browse the repository at this point in the history
added remove_text to image comparison decorator

Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>

removed inaccurate comments

Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>

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 <quantum.analyst@gmail.com>

got rid of colorbar

removed colorbar and changed test image
  • Loading branch information
matt256 committed Dec 23, 2022
1 parent 65dc9be commit 845b22a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/axes_grid1/inset_locator.py
Expand Up @@ -73,7 +73,7 @@ def __call__(self, ax, renderer):
bbox = self.get_window_extent(renderer)
px, py = self.get_offset(bbox.width, bbox.height, 0, 0, renderer)
bbox_canvas = Bbox.from_bounds(px, py, bbox.width, bbox.height)
tr = ax.figure.transFigure.inverted()
tr = ax.figure.transSubfigure.inverted()
return TransformedBbox(bbox_canvas, tr)


Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
Expand Up @@ -716,3 +716,23 @@ def test_removal():
fig.canvas.draw()
col.remove()
fig.canvas.draw()


@image_comparison(['anchored_locator_base_call.png'], style="mpl20")
def test_anchored_locator_base_call():
fig = plt.figure(figsize=(3, 3))
fig1, fig2 = fig.subfigures(nrows=2, ncols=1)

ax = fig1.subplots()
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))
ax.set(xticks=[], yticks=[])

Z = cbook.get_sample_data(
"axes_grid/bivariate_normal.npy", np_load=True
)
extent = (-3, 4, -4, 3)

axins = zoomed_inset_axes(ax, zoom=2, loc="upper left")
axins.set(xticks=[], yticks=[])

axins.imshow(Z, extent=extent, origin="lower")

0 comments on commit 845b22a

Please sign in to comment.