-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
[mplot3d] Add custom values for determining colors in trisurf #23878
base: main
Are you sure you want to change the base?
Conversation
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 while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. 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.
Thanks! Can you please add a test for this? I think that maybe your example could be a good one. |
Note that this is adding a 3D version of |
This appears to be a new feature; I'm not sure why you marked it as N/A. |
It is not really the same behavior as in
|
Should it use |
I though the change is so small, that it cannot really be called a new feature, but okay, will add it to whats new. |
Thank you all for the input. I did some changes to the PR:
|
Look again! import matplotlib.pyplot as plt
x = [0, 1, 1, 0]
y = [0, 0, 1, 1]
C = [0, 1, 2, 3]
fig, ax = plt.subplots()
mappable = ax.tripcolor(x, y, C)
fig.colorbar(mappable, ax=ax)
plt.show() |
Oh, okay. You are right. I have not tried it, just read the documentation here https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.tripcolor.html There it says that |
This is the warning in the failing doc-build:
I think that you may need to create a new branch as there are changes on the main branch that are required to make the tests pass and since you have used your main branch, it is not really possible (in an easier way) to sort it out. Something like:
And then open a new PR with the You may have to set upstream if it complains in the third step:
Here is a more general description: https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git |
I think the casing c vs C is not consistent in our docs. In general, we tend to use uppercase for 2D arrays (think |
@aaarne Do you plan to come back to this? Let us know in case you need any help. |
PR Summary
This PR adds the possibility to color faces individually in
plot_trisurf
. Before one could only use one color for all faces, or use a colormap encoding the mean z-coordinate of the vertices at each triangle for the triangle's surface. In this PR the function get a new keyword argument calledc
, defaulting to None. One can now specify a value for each vertex viac
. Then these values are used to determine face-colors via the colormap, not the mere z-coordinates.Example
Plots like this were not possible, even not with the
color
keyword argument - this only allowed for a single color.PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).