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 22806ae

Browse filesBrowse files
committed
Fix image alpha in PNG backend
1 parent f3895f9 commit 22806ae
Copy full SHA for 22806ae

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed

‎lib/matplotlib/tests/test_image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_image.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ def test_image_alpha():
176176
np.random.seed(0)
177177
Z = np.random.rand(6, 6)
178178

179-
plt.subplot(121)
179+
plt.subplot(131)
180+
plt.imshow(Z, alpha=1.0, interpolation='none')
181+
182+
plt.subplot(132)
180183
plt.imshow(Z, alpha=0.5, interpolation='none')
181184

182-
plt.subplot(122)
185+
plt.subplot(133)
183186
plt.imshow(Z, alpha=0.5, interpolation='nearest')
184187

185188
@cleanup

‎src/_backend_agg_wrapper.cpp

Copy file name to clipboardExpand all lines: src/_backend_agg_wrapper.cpp
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, P
299299
x = mpl_round(x);
300300
y = mpl_round(y);
301301

302+
gc.alpha = 1.0;
302303
CALL_CPP("draw_image", (self->x->draw_image(gc, x, y, image)));
303304

304305
Py_RETURN_NONE;

0 commit comments

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