plotly / plotly/plotly.py

Indicator domain doesn't work in make_subplots()

Open
#4,710 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

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()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Python example in a Jupyter Notebook and inspect how make_subplots() assigns domains to the go.Indicator traces. Compare the requested row and column positions with the rendered result, then verify that indicators can be vertically positioned as described and that the example behaves consistently across the four subplot cells.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.