Honor cmap for numeric scatter colors#616
Merged
cvanelteren merged 5 commits intomainfrom Mar 17, 2026
Merged
Conversation
Treat 1D numeric scatter c arrays matching the point count as scalar data for colormapping instead of literal RGBA colors. This preserves Nx3/Nx4 explicit color support, keeps the Matplotlib-compatible cmap behavior for numeric values, and adds a regression test for issue #615.
2aa6748 to
ce73924
Compare
Annotate the scatter-specific color parsing helpers touched by the cmap compatibility fix so the intent of the new parameters and return values is explicit without broadening the typing changes beyond the affected code path.
Collaborator
Author
|
Reminder: review this later today. |
Document the scatter color ambiguity resolved by the PR: one-dimensional numeric arrays matching the point count are treated as scalar colormap data, while explicit RGB(A) colors should be passed as N x 3 / N x 4 arrays or via color=.
Replace the loose Any annotations on the scatter color parsing helpers with explicit data and color input aliases based on ArrayLike and color tuples. This keeps the typing aligned with the actual ambiguity being resolved by the cmap fix while staying practical for plotting inputs.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a Matplotlib-compatibility bug in
ax.scatter(...)whencis a 1D numeric array. UltraPlot was treating short numeric sequences like[0.1, 0.2, 0.3, 0.4]as literal colors too early, which causedcmapto be dropped as unused instead of applying colormapping. The fix keeps explicitN x 3/N x 4RGB(A) handling intact, but treats 1D numeric arrays matching the point count as scalar data for colormapping, which is the behavior users expect from Matplotlib. A regression test covering the reportedc=[...], cmap="turbo"case is included.Closes #615.