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

Backport PR #18500 on branch v3.3.x (BUG: Fix all-masked imshow)#18504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionslib/matplotlib/image.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -474,8 +474,10 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
# do not run the vmin/vmax through the same pipeline we can
# have values close or equal to the boundaries end up on the
# wrong side.
vrange = np.array([self.norm.vmin, self.norm.vmax],
dtype=scaled_dtype)
vmin, vmax = self.norm.vmin, self.norm.vmax
if vmin is np.ma.masked:
vmin, vmax = a_min, a_max
vrange = np.array([vmin, vmax], dtype=scaled_dtype)

A_scaled -= a_min
vrange -= a_min
Expand Down
8 changes: 8 additions & 0 deletionslib/matplotlib/tests/test_image.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -846,6 +846,14 @@ def test_mask_image():
ax2.imshow(A, interpolation='nearest')


def test_mask_image_all():
# Test behavior with an image that is entirely masked does not warn
data = np.full((2, 2), np.nan)
fig, ax = plt.subplots()
ax.imshow(data)
fig.canvas.draw_idle() # would emit a warning


@image_comparison(['imshow_endianess.png'], remove_text=True)
def test_imshow_endianess():
x = np.arange(10)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp