plotly / plotly/plotly.py

Indicator domain doesn't work in make_subplots()

Offen
#4,710 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie damit, das bereitgestellte Python-Beispiel in einem Jupyter Notebook auszuführen, und untersuchen Sie, wie make_subplots() den go.Indicator-Traces Domänen zuweist. Vergleichen Sie die angeforderten Zeilen- und Spaltenpositionen mit dem gerenderten Ergebnis. Überprüfen Sie anschließend, dass die Indikatoren wie beschrieben vertikal positioniert werden können und dass sich das Beispiel über die vier Subplot-Zellen hinweg konsistent verhält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
jupyter-notebook, python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.