Skip to content

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

Open
@johentsch

Description

@johentsch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions