plotly / plotly/plotly.py

fig.add_vline fails on figure with a separate subplot containing Scatter3d

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

还没有人认领这个 Issue。

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

描述

The following code creates a 2D subplot in the left column and a 3D subplot in the right column. Adding a vertical line to the 2D subplot fails if a Scatter3d has been added to the 3D subplot.

Another bug shown in this example is that add_vline does not add any annotations if the plot is empty.

from plotly import subplots
specs = [
    [{}, {'type': 'scene', 'rowspan': 1}],
]
fig = subplots.make_subplots(rows=1, cols=2, specs=specs)

# Add dummy data 
# If both of these are commented out, fig.add_vline does nothing
# If neither are commented out, fig.add_vline raises a PlotlyKeyError
# If fig.add_scatter3d is commented out, the figure is generated successfully
fig.add_scatter(x=[0, 1], y=[0, 1], row=1, col=1)
fig.add_scatter3d(x=[0, 1], y=[0, 1], z=[0, 1], row=1, col=2)

# Add vertical line to left (2D) subplots only
fig.add_vline(x=2, col=1)  # Raises PlotlyKeyError

(Plotly version 5.9.0)

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先复现提供的 make_subplots、add_scatter3d 和 add_vline 示例,包括所展示的三种数据配置。跟踪 add_vline 的入口点及其对 2D 和 scene 子图的处理;当 2D 垂直线不再引发 PlotlyKeyError 且空图接收到注释时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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