plotly / plotly/plotly.py

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

未关闭
#3,054 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug documentation P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在报告的 Plotly 版本上使用 sequential.YlOrRd 列表复现文档中的 unlabel_rgb 示例。追踪从 plotly.colors 导入的 unlabel_rgb,并比较它对单个颜色和列表的行为;当文档中的列表输入能够正常工作且不再出现报告的 ValueError,同时现有的单颜色行为保持不变时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。