plotly / plotly/plotly.py

Error bars in px.scatter should inherit color and opacity from markers by default

未关闭
#4,353 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Error bars do correctly show with the same color (not opacity) as markers when using categorical data to set the color parameter:

import plotly.express as px
df = px.data.iris()
df["e_plus"] = df["sepal_width"]/100
df["e_minus"] = df["sepal_width"]/40
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                 error_y="e_plus", error_y_minus="e_minus")

fig.show()
image

However, setting the opacity parameter only changes the opacity of the markers:

fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                 error_y="e_plus", error_y_minus="e_minus", opacity=0.6)

fig.show()
image

And using numerical data to set the color parameter, the error bars will not have the same color as the markers, but instead renders in black:

fig = px.scatter(df, x="sepal_width", y="sepal_length", color="petal_width",
                 error_y="e_plus", error_y_minus="e_minus")

fig.show()
image

Fixing this would be super helpful, since the only current solution seems to be to manually add or update the trace for every single data point to set rgba-values for the error bars. My scatter plot had a few thousand data points, making that a very time consuming for-loop.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从提供的 px.scatter 复现开始,使用分类和数值颜色值,分别测试有透明度和无透明度的情况。检查生成的误差条和标记设置,以确定它们的颜色和透明度在哪些地方存在差异。完成标准是:在所有展示的情况下,误差条默认继承标记的颜色和透明度,并为这些复现提供覆盖测试。

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

评估

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

把新 issue 发到你的邮箱

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