plotly / plotly/plotly.py

Sunburst plots override font size and don't position unreadable labels outside

Offen
#2,029 3 Kommentare 2 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

Hi everyone,

just discovered sunburst plots and am loving them! Besides the problem of text orientation that is momentarily being solved, I am wondering why it is possible to style outsidetextfont but not possible to actually place text outside the chart (at least for the last level). Similarly to pie charts, I would expect to find a textposition = 'outside' parameter. At the moment, for tiny wedges, the labels are being squeezed in no matter what, ignoring the font sizes given in insidetextfont AND textfont. Example:

import plotly.graph_objects as go
data = pd.DataFrame.from_dict({'key': {0: '#iii',
  1: '#vi',
  2: 'I',
  3: 'III',
  4: 'V',
  5: 'bII',
  6: 'i',
  7: 'ii',
  8: 'iii',
  9: 'iv',
  10: 'v',
  11: 'major',
  12: 'minor'},
 'duration': {0: 4.0,
  1: 12.0,
  2: 85.0,
  3: 202.0,
  4: 4.0,
  5: 4.5,
  6: 655.0,
  7: 5.0,
  8: 4.0,
  9: 33.5,
  10: 54.5,
  11: 295.5,
  12: 768.0},
 'parent': {0: 'minor',
  1: 'minor',
  2: 'major',
  3: 'major',
  4: 'major',
  5: 'major',
  6: 'minor',
  7: 'minor',
  8: 'minor',
  9: 'minor',
  10: 'minor',
  11: '',
  12: ''}})
fig =go.Figure(go.Sunburst(
    labels=data.key,
    parents=data.parent,
    values=data.duration,
    branchvalues="total", 
    textfont = {'size': 20},
    insidetextfont = {'size': 20},
    textinfo = "label+percent parent",
    #textposition='outside' <-- this option is missing
    ))
fig.show()

sunburst

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

Führen Sie zunächst die bereitgestellte Python-Reproduktion mit go.Sunburst aus und vergleichen Sie die Platzierung der Beschriftungen und das Verhalten der Schriftgröße mit dem im Issue erwähnten Verhalten des pie-chart. Verfolgen Sie die Optionen für sunburst-Beschriftungen und ermitteln Sie das erwartete Verhalten für die Platzierung außerhalb, winzige Segmente und textfont/insidetextfont; abgeschlossen ist die Aufgabe, wenn die angeforderte Option und das Größenverhalten im gemeldeten Beispiel funktionieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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