10000 Restore python2 sorting · matplotlib/matplotlib@27c26f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27c26f1

Browse files
committed
Restore python2 sorting
1 parent 273462d commit 27c26f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def split_list(a_list):
3737
# in both python 2 and 3
3838
unfilled_markers = [m for m, func in iteritems(Line2D.markers)
3939
if func != 'nothing' and m not in Line2D.filled_markers]
40-
# Reverse-sort for pretty
41-
unfilled_markers = sorted(unfilled_markers, key=str)[::-1]
40+
# Reverse-sort for pretty. We use our own sort key which is essentially
41+
# a python3 compatible reimplementation of python2 sort.
42+
unfilled_markers = sorted(unfilled_markers,
43+
key=lambda x: (str(type(x)), str(x)))[::-1]
4244
for ax, markers in zip(axes, split_list(unfilled_markers)):
4345
for y, marker in enumerate(markers):
4446
ax.text(-0.5, y, nice_repr(marker), **text_style)

0 commit comments

Comments
 (0)
0