8000 Test for grayscale image alpha · matplotlib/matplotlib@141d796 · GitHub
[go: up one dir, main page]

Skip to content

Commit 141d796

Browse files
committed
Test for grayscale image alpha
1 parent f2d59a4 commit 141d796

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Binary file not shown.

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,16 @@ def test_hatching_legend():
119119
b = plt.Rectangle([0, 0], 0, 0, facecolor="blue", hatch="XXXX")
120120

121121
fig.legend([a, b, a, b], ["", "", "", ""])
122+
123+
124+
@image_comparison(baseline_images=['grayscale_alpha'],
125+
extensions=['pdf'], tol=1e-3)
126+
def test_grayscale_alpha():
127+
"""Masking images with NaN did not work for grayscale images"""
128+
x, y = np.ogrid[-2:2:.1, -2:2:.1]
129+
dd = np.exp(-(x**2 + y**2))
130+
dd[dd < .1] = np.nan
131+
fig, ax = plt.subplots()
132+
ax.imshow(dd, interpolation='none', cmap='gray_r')
133+
ax.set_xticks([])
134+
ax.set_yticks([])

0 commit comments

Comments
 (0)
0