-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix python3 issues in some examples #3831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
414bcff
d0bb8c1
280001a
247a0ec
a67a8d6
6a86f69
45f4035
6dbfe7a
fc226b6
6fda3df
fbf0da9
273462d
27c26f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
Reference for filled- and unfilled-marker types included with Matplotlib. | ||
""" | ||
from six import iteritems | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from matplotlib.lines import Line2D | ||
|
@@ -32,7 +33,9 @@ def split_list(a_list): | |
fig, axes = plt.subplots(ncols=2) | ||
|
||
# Filter out filled markers and marker settings that do nothing. | ||
unfilled_markers = [m for m, func in Line2D.markers.items() | ||
# We use iteritems from six to make sure that we get an iterator | ||
# in both python 2 and 3 | ||
unfilled_markers = [m for m, func in iteritems(Line2D.markers) | ||
if func != 'nothing' and m not in Line2D.filled_markers] | ||
# Reverse-sort for pretty | ||
unfilled_markers = sorted(unfilled_markers, key=str)[::-1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not actually reproduce the original python2 behaviour (ints are sorted before strings). Rather this converts the int to a string before sorting so 2 will be the same as '2' There don't seem to be an easy way to restore python2 sorting order without rolling out our own function which seems overkill in this case. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put the comment above the relevant statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done