FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add 3D scatter test for cmap update by MiniX16 · Pull Request #30062 · matplotlib/matplotlib · GitHub

Repository navigation

Add 3D scatter test for cmap update - #30062

Merged
oscargus merged 1 commit into
matplotlib:mainfrom
MiniX16:scalarmap-change-with-cmap-test
May 18, 2025
Merged

oscargus merged 1 commit into
matplotlib:mainfrom
MiniX16:scalarmap-change-with-cmap-test

Conversation

MiniX16 commented May 17, 2025

Copy link
Copy Markdown
Contributor

PR summary

This PR adds a new test to verify that changing the colormap of a 3D scatter plot (Axes3D.scatter) after drawing the figure properly updates the face colors.

Why is this change necessary?

There was previously no test ensuring that colormap updates on 3D scatter plots are reflected after a figure draw. This test ensures consistency with 2D behavior and guards against regressions.

What problem does it solve?

Confirms that calling set_cmap() after drawing does in fact update the plotted colors in 3D, which has historically been a bug but seems to be fixed.

What is the reasoning for this implementation?

The test draws a 3D scatter plot with an initial colormap ('jet'), forces a draw, changes the colormap to 'viridis', and compares it against a reference plot created directly with 'viridis'.

This ensures the update mechanism behaves correctly post-render.

Minimal example

sc = ax.scatter(x, y, z, c=values, cmap='jet')
fig.canvas.draw()
sc.set_cmap('viridis')

Closes #18931


PR checklist

github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

dstansby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks a lot - looks good to me.

Copy link
Copy Markdown
Member

Thanks and congratulations on your first merged PR in Matplotlib. Looks that there may be two soon. Hoping to see you around!

oscargus merged commit 35c5481 into matplotlib:main May 18, 2025
QuLogic added this to the v3.11.0 milestone May 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3D collections do not proper handle edgecolor='face'

4 participants


Back | FazBrowse Home | New Git URL