Skip to content

Commit 6ad937a

Browse files
authored
Merge pull request matplotlib#30838 from has2k1/fix-numpy-integer-markers
Do not fail when markers are numpy integers
2 parents 8be47e4 + c8b4dfb commit 6ad937a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/matplotlib/markers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"""
130130
import copy
131131

132-
from collections.abc import Sized
132+
from collections.abc import Hashable, Sized
133133

134134
import numpy as np
135135

@@ -308,7 +308,7 @@ def _set_marker(self, marker):
308308
"""
309309
if isinstance(marker, str) and cbook.is_math_text(marker):
310310
self._marker_function = self._set_mathtext_path
311-
elif isinstance(marker, (int, str)) and marker in self.markers:
311+
elif isinstance(marker, Hashable) and marker in self.markers:
312312
self._marker_function = getattr(self, '_set_' + self.markers[marker])
313313
elif (isinstance(marker, np.ndarray) and marker.ndim == 2 and
314314
marker.shape[1] == 2):

lib/matplotlib/tests/test_marker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_marker_fillstyle():
2222
r'$\frac{1}{2}$',
2323
"$\u266B$",
2424
1,
25+
np.int64(1),
2526
markers.TICKLEFT,
2627
[[-1, 0], [1, 0]],
2728
np.array([[-1, 0], [1, 0]]),

0 commit comments

Comments
 (0)