unlabel_rgb does not work on a list as it says in the docs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
The docs say "This function takes either an ‘rgb(a, b, c)’ color or a list of such colors" but a list fails.
windows 10, plotly 4.14.3
from plotly.colors import *
colorset = sequential.YlOrRd
print([unlabel_rgb(c) for c in colorset])
print(unlabel_rgb(colorset))
[(255.0, 255.0, 204.0), (255.0, 237.0, 160.0), (254.0, 217.0, 118.0), (254.0, 178.0, 76.0), (253.0, 141.0, 60.0), (252.0, 78.0, 42.0), (227.0, 26.0, 28.0), (189.0, 0.0, 38.0), (128.0, 0.0, 38.0)]
ValueError Traceback (most recent call last)
in
2 colorset = sequential.YlOrRd
3 print([unlabel_rgb(c) for c in colorset])
----> 4 print(unlabel_rgb(colorset))
~\Anaconda3\Lib\site-packages_plotly_utils\colors_init_.py in unlabel_rgb(colors)
741 str_num = str_num + char
742 else:
--> 743 numbers.append(float(str_num))
744 str_num = ""
745 return (numbers[0], numbers[1], numbers[2])
ValueError: could not convert string to float: ''
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented unlabel_rgb example with the sequential.YlOrRd list on the reported Plotly version. Trace unlabel_rgb from the plotly.colors import and compare its behavior for one color versus a list; done means the documented list input works without the reported ValueError and the existing single-color behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100