Skip to content

Commit 9e0861e

Browse files
committed
Fixups from review
1 parent 821617b commit 9e0861e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ def _set_alpha_for_array(self, alpha):
982982
Artist.set_alpha(self, alpha)
983983
return
984984
alpha = np.asarray(alpha)
985-
if not (alpha.min() >= 0 and alpha.max() <= 1):
985+
if not (0 <= alpha.min() and alpha.max() <= 1):
986986
raise ValueError('alpha must be between 0 and 1, inclusive, '
987987
f'but min is {alpha.min()}, max is {alpha.max()}')
988988
self._alpha = alpha

lib/matplotlib/collections.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,9 @@ def set_alpha(self, alpha):
837837
838838
Parameters
839839
----------
840-
alpha: float or array of float
840+
alpha: float or array of float or None
841841
If not None, *alpha* values must be between 0 and 1, inclusive.
842-
If an array is provided, it's length must match the number of
842+
If an array is provided, its length must match the number of
843843
elements in the collection. Masked values and nans are not
844844
supported.
845845
"""
@@ -867,13 +867,13 @@ def update_scalarmappable(self):
867867
return
868868
if np.iterable(self._alpha):
869869
if self._alpha.size != self._A.size:
870-
# This can occur with the deprecated behavior of 'flat'
871-
# pcolormesh shading. If we bring the current change in
872-
# before that deprecated behavior is removed, we need to
873-
# add the explanation to the message below.
874870
raise ValueError(f'Data array shape, {self._A.shape} '
875871
'is incompatible with alpha array shape, '
876-
f'{self._alpha.shape}.')
872+
f'{self._alpha.shape}. '
873+
'This can occur with the deprecated '
874+
'behavior of the "flat" shading option, '
875+
'in which a row and/or column of the data '
876+
'array is dropped.')
877877
# pcolormesh, scatter, maybe others flatten their _A
878878
self._alpha = self._alpha.reshape(self._A.shape)
879879

lib/matplotlib/colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ def __call__(self, X, alpha=None, bytes=False):
615615
if alpha is not None:
616616
if np.iterable(alpha):
617617
alpha = np.asarray(alpha)
618-
if not (alpha.shape == xa.shape):
619-
raise ValueError("alpha is array-like but it's shape"
618+
if alpha.shape != xa.shape:
619+
raise ValueError("alpha is array-like but its shape"
620620
" %s doesn't match that of X %s" %
621621
(alpha.shape, xa.shape))
622622

lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def set_alpha(self, alpha):
274274
275275
Parameters
276276
----------
277-
alpha : float or 2-d array or None
277+
alpha : float or 2D array-like or None
278278
"""
279279
martist.Artist._set_alpha_for_array(self, alpha)
280280
if np.ndim(alpha) not in (0, 2):

0 commit comments

Comments
 (0)