-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Simplify colored_line()
implementation in Multicolored lines example
#29954
8000 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
Conversation
39d5328
to
47e4a69
Compare
colored_line()
implementation in Multicolored lines examplecolored_line()
implementation in Multicolored lines example
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
(xy[0, :][None, :], (xy[:-1, :] + xy[1:, :]) / 2, xy[-1, :][None, :]), axis=0 | ||
) | ||
segments = np.stack((xy_mid[:-1, :], xy, xy_mid[1:, :]), axis=-2) | ||
# Note that segments is [ |
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.
This comment is really confusing, and I don't think is correct, but certainly possible I am just confused. Segments should each be [0.5 * (xy[j-1] + xy[j]), xy[j], 0.5 * (xy[j] + xy[j+1])]?
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.
If something is "array" compatible, doesn't "np.asarray" convert it? I'm not clear on the motivation for this suggested change. I suppose it is a touch more efficient?
Since the following code still uses numpy methods, the only change here is for subclasses of ndarray, which |
I have noticed that making the starting point of each segment of the LineCollection more forward would make it plot more beautifully. I don't want to send any more PRs because there are seemingly endless improvements to this function, but I would be glad to have it as a consideration. |
PR summary
hstack
,column_stack
, etc.), which improves readability.autoscale_view
, thusset_xlim
, etc. need not to be called manually.stacklevel=2
inwarnings.warn
.PR checklist