plotly / plotly/plotly.py

enable setting px.scatter error bars of same color as the marker

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

还没有人认领这个 Issue。

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

描述

I am making an error bar plot using px.scatter. I want to set each error bar to the same color as the marker. Below is the code showing how I am making the scatter plot. As can be seen from the code, I have a continuous scale and the markers are colored based on the column 'size' from my dataframe. I have looked quite a lot in the plotly documentation but I am unable to find a way to set the error bars of the same color as the marker. Is there a fix for this? Does plotly support different colored error bars for continuous data? Any help or suggestions would be appreciated.

I have also attached a link to the screenshot of the plot (the plot is zoomed in). As can be seen from the plot, the markers have colors based on the continuous scale whereas the all the lines have the same color.

df = pd.read_csv(options['file'], sep = ',')
size = df['size'].to_list()
fig = px.scatter(df, 
                x = "start", 
                y = "rank", 
                error_x = "duration",
                render_mode = 'auto', 
                facet_row = 'api',
                category_orders ={"api": ["MPIIO", "POSIX"]})

fig.update_traces(
    marker = dict(
        color= size,
        colorscale = "portland",
        colorbar=dict(
            title = "Request Size <br>(Bytes)",
            thickness=20
        ), 
        showscale=True
    ),                   
    error_x = dict(
        width = 0,
        symmetric=False,
    ),
)

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中所示的 px.scatter 和 fig.update_traces 调用开始,复现报告的启用 error_x 且使用连续 marker 颜色的 px.scatter 示例。确定 Plotly 是否支持将连续 marker 颜色映射到误差条,并在该示例生成与每个 marker 颜色匹配的误差条,或以清晰的解释记录该限制时,视为工作完成。

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

评估

技术栈
python
领域
data-visualization
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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