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

Commite2dd1ba

Browse files
authored
Merge pull request#18504 from meeseeksmachine/auto-backport-of-pr-18500-on-v3.3.x
Backport PR#18500 on branch v3.3.x (BUG: Fix all-masked imshow)
2 parents6ba186c +4ddec28 commite2dd1ba

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎lib/matplotlib/image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,10 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
474474
# do not run the vmin/vmax through the same pipeline we can
475475
# have values close or equal to the boundaries end up on the
476476
# wrong side.
477-
vrange=np.array([self.norm.vmin,self.norm.vmax],
478-
dtype=scaled_dtype)
477+
vmin,vmax=self.norm.vmin,self.norm.vmax
478+
ifvminisnp.ma.masked:
479+
vmin,vmax=a_min,a_max
480+
vrange=np.array([vmin,vmax],dtype=scaled_dtype)
479481

480482
A_scaled-=a_min
481483
vrange-=a_min

‎lib/matplotlib/tests/test_image.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,14 @@ def test_mask_image():
846846
ax2.imshow(A,interpolation='nearest')
847847

848848

849+
deftest_mask_image_all():
850+
# Test behavior with an image that is entirely masked does not warn
851+
data=np.full((2,2),np.nan)
852+
fig,ax=plt.subplots()
853+
ax.imshow(data)
854+
fig.canvas.draw_idle()# would emit a warning
855+
856+
849857
@image_comparison(['imshow_endianess.png'],remove_text=True)
850858
deftest_imshow_endianess():
851859
x=np.arange(10)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp