8000 # This is a combination of 4 commits. · matt256/matplotlib@818c0fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 818c0fd

Browse files
committed
# This is a combination of 4 commits.
# This is the 1st commit message: bug fix inserted # This is the commit message matplotlib#2: issue test runs but fails comparison # This is the commit message matplotlib#3: updated styling in test image # This is the commit message matplotlib#4: bug fix inserted
1 parent cc85fb6 commit 818c0fd

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 2 deletions
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

@@ -388,7 +388,6 @@ def inset_axes(parent_axes, width, height, loc='upper right',
388388
inset_axes : *axes_class*
389389
Inset axes object created.
390390
"""
391-
392391
if axes_class is None:
393392
axes_class = HostAxes
394393
if axes_kwargs is None:

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,3 +707,28 @@ def test_removal():
707707
fig.canvas.draw()
708708
col.remove()
709709
fig.canvas.draw()
710+
@image_comparison(['anchored_locator_base_call.png'], style="classic")
711+
def test_anchored_locator_base_call():
712+
fig = plt.figure(figsize=(3,3))
713+
fig1, fig2 = fig.subfigures(nrows=2, ncols=1, height_ratios=[1, 1], squeeze=True)
714+
715+
ax = fig1.subplots()
716+
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))
717+
718+
Z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
719+
extent = (-3, 4, -4, 3)
720+
721+
axins = zoomed_inset_axes(ax, zoom=2, loc='upper left')
722+
axins.set(xticks=[], yticks=[])
723+
im = axins.imshow(Z, extent=extent, origin="lower")
724+
725+
# colorbar
726+
cax = inset_axes(axins,
727+
width="5%", # width = 10% of parent_bbox width
728+
height="100%", # height : 50%
729+
loc='lower left',
730+
bbox_to_anchor=(1.05, 0., 1, 1),
731+
bbox_transform=axins.transAxes,
732+
borderpad=0,
733+
)
734+
fig.colorbar(im, cax=cax)

0 commit comments

Comments
 (0)
0