Repository navigation
Fix single-color palette sampling - #5882
Open
i246506-Syeda-Khadija-Zaidi wants to merge 1 commit into
Open
i246506-Syeda-Khadija-Zaidi wants to merge 1 commit into
i246506-Syeda-Khadija-Zaidi wants to merge 1 commit into
Conversation
Contributor
|
Hi! Thanks for the pull request. To help us deal with the increased volume of contributions we’re receiving, can you answer two questions about this work?
We spend significant human effort reviewing each PR, so we really appreciate your help figuring out the best way to move this one toward merging. Thanks! |
This branch has not been deployed
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.
Link to issue
Closes #5805
Description of change
Fixed division-by-zero errors when requesting a single color using
n_colors()andsample_colorscale().Both functions now correctly handle requests for one color by returning the first color in the requested range.
Demo
Not applicable. This change fixes color utility functions and does not introduce visual changes to Plotly charts.
Testing strategy
Added regression tests for both
n_colors()andsample_colorscale()with a single-color request.Ran
python -m pytest tests/test_core/test_colors/test_colors.py -q— all 11 tests passed.Additional information (optional)
This change ensures that requesting a single color does not result in a
ZeroDivisionError.Guidelines