Box Plot line color changes the fill color as well, unless fill color is specified
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
When setting the line color for a box plot, it also makes the fill color of the box plot the same as the line color (with a different opacity I think). This is the case unless the fill color is set explicitly, but this doesn't help if for example your using a layout template for your colors. In my example below for the expected output I have to use a color picker to get the color of the default theme then put that into the fillcolor argument.
import plotly.graph_objects as go
import plotly.data
from plotly.subplots import make_subplots
data = plotly.data.iris()
fig = make_subplots(rows = 3, cols = 1, shared_xaxes=True)
fig.add_traces([
go.Box(
x = data["species"],
y = data["sepal_length"],
name = "no line color"
),
go.Box(
x = data["species"],
y = data["sepal_length"],
line = {"color":"black"},
name = "line color = black"
),
go.Box(
x = data["species"],
y = data["sepal_length"],
fillcolor = "#a4adf8", #shouldnt need to do this
line = {"color":"black"},
name = "expected"
)
], rows = [1,2,3], cols = [1,1,1])
fig

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 plotly.graph_objects.Box 运行提供的 Python 复现代码,并比较三个 trace,重点关注 line.color 与 fillcolor 之间的交互。设置箱线图的线条颜色后不再改变默认填充颜色,并且预期示例无需指定 fillcolor 即可正常工作时,修复就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100