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

Skip to content

Commit 12a8b64

Browse files
committed
Merge pull request matplotlib#1854 from ajdawson/bugfix-marker-list
BF - prevent a TypeError for lists of vertices
2 parents 260373e + 988a567 commit 12a8b64

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lib/matplotlib/markers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def set_marker(self, marker):
164164
self._marker_function = self._set_tuple_marker
165165
elif isinstance(marker, np.ndarray):
166166
self._marker_function = self._set_vertices
167-
elif marker in self.markers:
167+
elif not isinstance(marker, list) and marker in self.markers:
168168
self._marker_function = getattr(
169169
self, '_set_' + self.markers[marker])
170170
elif is_string_like(marker) and is_math_text(marker):

lib/matplotlib/tests/test_axes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,20 @@ def test_transparent_markers():
10061006
ax = fig.add_subplot(111)
10071007
ax.plot(data, 'D', mfc='none', markersize=100)
10081008

1009+
@image_comparison(baseline_images=['vertex_markers'], extensions=['png'],
1010+
remove_text=True)
1011+
def test_vertex_markers():
1012+
data = range(10)
1013+
marker_as_tuple = ((-1, -1), (1, -1), (1, 1), (-1, 1))
1014+
marker_as_list = [(-1, -1), (1, -1), (1, 1), (-1, 1)]
1015+
fig = plt.figure()
1016+
ax = fig.add_subplot(111)
1017+
ax.plot(data, linestyle='', marker=marker_as_tuple, mfc='k')
1018+
ax.plot(data[::-1], linestyle='', marker=marker_as_list, mfc='b')
1019+
ax.set_xlim([-1, 10])
1020+
ax.set_ylim([-1, 10])
1021+
1022+
10091023
if __name__=='__main__':
10101024
import nose
10111025
nose.runmodule(argv=['-s','--with-doctest'], exit=False)

0 commit comments

Comments
 (0)