Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdaa7b1d

Browse files
committed
Fix NonUniformImage with nonlinear scale
1 parent975b584 commitdaa7b1d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎lib/matplotlib/image.py

Lines 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)forxinnp.linspace(l,r,width)])[:,0]
1095+
y_pix=invertedTransform.transform(
1096+
[(l,y)foryinnp.linspace(b,t,height)])[:,1]
1097+
10941098
ifself._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)

[8]ページ先頭

©2009-2025 Movatter.jp