plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

unlabel_rgb does not work on a list as it says in the docs

Open simonm3 opened this issue 4 years ago • 2 comments

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: ''

simonm3 avatar Jan 30 '21 09:01 simonm3

@LiamConnors @alexcjohnson is this a bug or a feature request?

gvwilson avatar Aug 12 '24 15:08 gvwilson

Sure looks like a bug to me, should be a simple fix.

alexcjohnson avatar Aug 16 '24 15:08 alexcjohnson