Skip to content

Commit

Permalink
Make sure _edgecolors is a string before comparison
Browse files Browse the repository at this point in the history
Fixes numpy deprecation warning. Comparing a numpy array to a string
will return an array in future numpy versions
  • Loading branch information
jenshnielsen committed Aug 15, 2015
1 parent 8fd0ee8 commit 5e8fb62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/matplotlib/collections.py
Expand Up @@ -617,7 +617,8 @@ def get_facecolor(self):
get_facecolors = get_facecolor

def get_edgecolor(self):
if self._edgecolors == str('face'):
if (isinstance(self._edgecolors, six.string_types)
and self._edgecolors == str('face')):
return self.get_facecolors()
else:
return self._edgecolors
Expand Down Expand Up @@ -678,7 +679,8 @@ def set_alpha(self, alpha):
except (AttributeError, TypeError, IndexError):
pass
try:
if self._edgecolors_original != str('face'):
if (not isinstance(self._edgecolors_original, six.string_types)
or self._edgecolors_original != str('face')):
self._edgecolors = mcolors.colorConverter.to_rgba_array(
self._edgecolors_original, self._alpha)
except (AttributeError, TypeError, IndexError):
Expand Down

0 comments on commit 5e8fb62

Please sign in to comment.