-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Correctly skip colors for nan points given to scatter #7570
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
0b201e6
cc5cbe5
d6c47af
ab11d0d
7cabe13
e5469f5
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 |
---|---|---|
|
@@ -4848,9 +4848,12 @@ def test_scatter_color_masking(): | |
x = np.array([1, 2, 3]) | ||
y = np.array([1, np.nan, 3]) | ||
colors = np.array(['k', 'w', 'k']) | ||
linewidths = np.array([1, 2, 3]) | ||
s = plt.scatter(x, y, color=colors) | ||
|
||
facecolors = s.get_facecolors() | ||
linecolors = s.get_edgecolors() | ||
linewidths = s.get_linewidths() | ||
assert_array_equal(facecolors[1], np.array([0, 0, 0, 1])) | ||
assert_array_equal(linecolors[1], np.array([0, 0, 0, 1])) | ||
assert linewidths[1] == 3 | ||
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. also maybe assert facecolors[0], name edgecolors = s.get_edgecolors(), 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. I think I'm missing something here - should I just rename |
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.
probably unnecessary, but what about a test that verifies it's the right facecolor for the right value? Just to ensure no weird shifting.
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.
Is there a way to get the scatter points out from
s
? All I can see that might do it is s.get_paths(), but that seems to give arrays that are definitely not what I'm looking for...Uh oh!
There was an error while loading. Please reload this page.
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.
Ugh, unfortunately haven't found a direct way though there might be one. :( As much as I'm loath to suggest an image test, that seems to be the trick. Though the way to test the error you're seeing below is to use the s.get_edgecolors(), so maybe that'd be good enough?