Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c778bd9

Browse files
committed
Add docstring to _get_scalar_alpha.
1 parent 5a263e9 commit c778bd9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/matplotlib/image.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ def set_alpha(self, alpha):
293293
self._imcache = None
294294

295295
def _get_scalar_alpha(self):
296+
"""
297+
Get a scalar alpha value to be applied to the artist as a whole.
298+
299+
If the alpha value is a matrix, the method returns 1.0 because pixels
300+
have individual alpha values (see `~._ImageBase._make_image` for
301+
details). If the alpha value is a scalar, the method returns said value
302+
to be applied to the artist as a whole because pixels do not have
303+
individual alpha values.
304+
"""
296305
return 1.0 if self._alpha is None or np.ndim(self._alpha) > 0 \
297306
else self._alpha
298307

0 commit comments

Comments
 (0)