Colors given as tuple of ints are not working anymore for LinearColormap and StepColormap since v0.8.0
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从 branca.colormap._parse_color 开始,跟踪 LinearColormap 和 StepColormap 如何将它们的颜色传递给它。复现 issue 中的整数元组示例,然后验证元组是否被规范化为 float 颜色值,以及 rgb_bytes_tuple 和 rgba_floats_tuple 是否为两种 colormap 类型生成预期结果。
由索引模型根据 Issue 内容生成。
描述
When I create a LinearColormap or a StepColormap with a list of tuples of ints as argument for the colors parameter, it is no longer converted to floats and leads to incorrect results.
Current behaviour (v0.8.0 v0.8.1):
>>> from branca.colormap import LinearColormap
>>> colormap = LinearColormap(colors=[(128, 64, 255), (255, 128, 0)])
>>> colormap.colors
[(128, 64, 255, 1.0), (255, 128, 0, 1.0)]
>>> colormap.rgb_bytes_tuple(0)
(32767, 16383, 65279)
>>> colormap.rgba_floats_tuple(1)
(255, 128, 0, 1.0)
Expected behaviour (v0.7.2):
>>> from branca.colormap import LinearColormap
>>> colormap = LinearColormap(colors=[(128, 64, 255), (255, 128, 0)])
>>> colormap.colors
[(0.5019607843137255, 0.25098039215686274, 1.0, 1.0), (1.0, 0.5019607843137255, 0.0, 1.0)]
>>> colormap.rgb_bytes_tuple(0)
(128, 64, 255)
>>> colormap.rgba_floats_tuple(1)
(1.0, 0.5019607843137255, 0.0, 1.0)
This seems to be due to the internal _parse_color function that was broken in https://github.com/python-visualization/branca/commit/8a8a2141c13947f6afaaf65a8c29c4417cd3a5a3#diff-6886114fc8e4fd6197705978c768e1f49469e2455fb1c4a8efda26a7b11bfa0bL51.
Current behaviour (v0.8.0 v0.8.1):
>>> from branca.colormap import _parse_color
>>> _parse_color((128, 64, 255))
(128, 64, 255, 1.0)
Expected behaviour (v0.7.2):
>>> from branca.colormap import _parse_color
>>> _parse_color((128, 64, 255))
(0.5019607843137255, 0.25098039215686274, 1.0, 1.0)
- 主要语言
- Python
- 星标
- 134
- 派生
- 69
- 平均合并
- 1 小时 10 分钟
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-visualization/branca 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 58/100
python-visualization/branca#222 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
python-visualization/branca#213 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 42/100
python-visualization/branca#195 ·
-
难度 3/5 1-2 天 新手友好度 35/100
python-visualization/branca#182 ·
-
难度 3/5 1-2 天 新手友好度 30/100
python-visualization/branca#174 · 9 条评论 ·
查看 python-visualization/branca 的全部 Issue
相似的 Issue
-
essnmx good first issue
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 65/100
syfoud/Simulated_Scepter#174 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Giskard-AI/giskard-oss#2840 · 1 条评论 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success 未关闭area: repo bug perceived difficulty: 2
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
yeti-platform/yeti#1380 ·