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 c91bf41

Browse filesBrowse files
committed
Fix NonUniformImage with nonlinear scale
1 parent 2723052 commit c91bf41
Copy full SHA for c91bf41

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed

‎lib/matplotlib/image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,12 +1085,16 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
10851085
B[:, :, 0:3] = A
10861086
B[:, :, 3] = 255
10871087
A = B
1088-
vl = self.axes.viewLim
10891088
l, b, r, t = self.axes.bbox.extents
10901089
width = int(((round(r) + 0.5) - (round(l) - 0.5)) * magnification)
10911090
height = int(((round(t) + 0.5) - (round(b) - 0.5)) * magnification)
1092-
x_pix = np.linspace(vl.x0, vl.x1, width)
1093-
y_pix = np.linspace(vl.y0, vl.y1, height)
1091+
1092+
invertedTransform = self.axes.transData.inverted()
1093+
x_pix = invertedTransform.transform(
1094+
[(x, b) for x in np.linspace(l, r, width)])[:, 0]
1095+
y_pix = invertedTransform.transform(
1096+
[(l, y) for y in np.linspace(b, t, height)])[:, 1]
1097+
10941098
if self._interpolation == "nearest":
10951099
x_mid = (self._Ax[:-1] + self._Ax[1:]) / 2
10961100
y_mid = (self._Ay[:-1] + self._Ay[1:]) / 2

0 commit comments

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