plotly / plotly/plotly.py

Indicator domain doesn't work in make_subplots()

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

还没有人认领这个 Issue。

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

描述

There seems to be a bug with the Indicator class domain/position when used in make_subplots()

I am trying to vertically position 2 indicators in a subplot, so that I have one above the other, but is not working.

Example below is adapted from the indicator example on the plotly website

I also tried { 'type ' : 'domain' } as I read this this might be the issue

version plotly = 5.23

fig made in Jupyter Notebook

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(
    rows=2, cols=2,
    specs=[ [{"type": "indicator"},{"type": "indicator"}] ,
           [{"type": "indicator"}, {"type": "indicator"}], 
          ]
    ,
)

fig.add_trace(go.Indicator(
    mode = "number+delta",
    value = 200,
    domain = {'x': [0, 0.5], 'y': [0, 0.5]},
    delta = {'reference': 400, 'relative': True, 'position' : "top"}), 
             col =1, 
             row = 1,
             )

fig.add_trace(go.Indicator(
    mode = "number+delta",
    value = 350,
    delta = {'reference': 400, 'relative': True},
    domain = {'x': [0.5, 1], 'y': [0.5, 1]}), 
              col =1, 
             row = 1,
             
             )

fig.add_trace(go.Indicator(
    mode = "number+delta",
    value = 450,
    title = {"text": "Accounts<br><span style='font-size:0.8em;color:gray'>Subtitle</span><br><span style='font-size:0.8em;color:gray'>Subsubtitle</span>"},
    delta = {'reference': 400, 'relative': True},
    domain = {'x': [0.6, 1], 'y': [0, 1]}), 
              col =2, 
             row = 2,
             )

fig.show()

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,在 Jupyter Notebook 中运行提供的 Python 示例,并检查 make_subplots() 如何为 go.Indicator traces 分配域。将请求的行和列位置与渲染结果进行比较,然后验证 indicators 是否可以按照描述进行垂直定位,以及该示例在四个 subplot 单元格中的行为是否一致。

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

评估

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

把新 issue 发到你的邮箱

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