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 f107207

Browse filesBrowse files
authored
Merge pull request #8601 from Tuan333/mpl_toolkit
Mpl toolkit fix for zoomed_inset_axes
2 parents 1e53be3 + e538714 commit f107207
Copy full SHA for f107207

File tree

Expand file treeCollapse file tree

4 files changed

+18
-4
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+18
-4
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-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,10 @@ def get_extent(self, renderer):
138138
self.parent_axes.transData)
139139

140140
x, y, w, h = bb.bounds
141-
142-
xd, yd = 0, 0
143-
144141
fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
145142
pad = self.pad * fontsize
146143

147-
return w*self.zoom+2*pad, h*self.zoom+2*pad, xd+pad, yd+pad
144+
return abs(w*self.zoom)+2*pad, abs(h*self.zoom)+2*pad, pad, pad
148145

149146

150147
class BboxPatch(Patch):
Loading
Loading

‎lib/mpl_toolkits/tests/test_axes_grid1.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_axes_grid1.py
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,20 @@ def get_demo_image():
154154
pad=0.1, borderpad=0.5, sep=5,
155155
frameon=False)
156156
ax.add_artist(asb)
157+
158+
159+
@image_comparison(baseline_images=['zoomed_axes',
160+
'inverted_zoomed_axes'],
161+
extensions=['png'])
162+
def test_zooming_with_inverted_axes():
163+
fig, ax = plt.subplots()
164+
ax.plot([1, 2, 3], [1, 2, 3])
165+
ax.axis([1, 3, 1, 3])
166+
inset_ax = zoomed_inset_axes(ax, zoom=2.5, loc=4)
167+
inset_ax.axis([1.1, 1.4, 1.1, 1.4])
168+
169+
fig, ax = plt.subplots()
170+
ax.plot([1, 2, 3], [1, 2, 3])
171+
ax.axis([3, 1, 3, 1])
172+
inset_ax = zoomed_inset_axes(ax, zoom=2.5, loc=4)
173+
inset_ax.axis([1.4, 1.1, 1.4, 1.1])

0 commit comments

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