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

Skip to content

Commit 5e8fb62

Browse files
committed
Make sure _edgecolors is a string before comparison
Fixes numpy deprecation warning. Comparing a numpy array to a string will return an array in future numpy versions
1 parent 8fd0ee8 commit 5e8fb62

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/collections.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ def get_facecolor(self):
617617
get_facecolors = get_facecolor
618618

619619
def get_edgecolor(self):
620-
if self._edgecolors == str('face'):
620+
if (isinstance(self._edgecolors, six.string_types)
621+
and self._edgecolors == str('face')):
621622
return self.get_facecolors()
622623
else:
623624
return self._edgecolors
@@ -678,7 +679,8 @@ def set_alpha(self, alpha):
678679
except (AttributeError, TypeError, IndexError):
679680
pass
680681
try:
681-
if self._edgecolors_original != str('face'):
682+
if (not isinstance(self._edgecolors_original, six.string_types)
683+
or self._edgecolors_original != str('face')):
682684
self._edgecolors = mcolors.colorConverter.to_rgba_array(
683685
self._edgecolors_original, self._alpha)
684686
except (AttributeError, TypeError, IndexError):

0 commit comments

Comments
 (0)