Skip to content

Adds function to sample colorscales #3136

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

Merged
merged 7 commits into from
May 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Handle string inputs with get_colorscale
  • Loading branch information
CarlAndersson committed May 10, 2021
commit 1b8ec25f55ee4472176d79045a8bcdedc4c68b5a
8 changes: 1 addition & 7 deletions packages/python/plotly/_plotly_utils/colors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,13 +854,7 @@ def sample_colorscale(colorscale, samplepoints, low=0.0, high=1.0, colortype="rg
validate_colorscale(colorscale)
except exceptions.PlotlyError:
if isinstance(colorscale, str):
if colorscale in PLOTLY_SCALES:
colorscale = PLOTLY_SCALES[colorscale]
else:
raise exceptions.PlotlyError(
"If your colorscale variable is a string, "
"it must be a Plotly scale."
)
colorscale = get_colorscale(colorscale)
else:
colorscale = make_colorscale(colorscale)

Expand Down