Skip to content

How to wrap labels in sunburst? #2527

@DigitalGabriele

Description

@DigitalGabriele

I have the following data and code. As you can see from the picture, sunburst makes the long labels really small. Is it possible to wrap them?

I tried playing with the "insidetextorientation", but it did not provide me the result I want.
Screenshot 2020-06-02 at 14 01 20

    import plotly.express as px
    import pandas as pd

    df = pd.read_excel("/Users/stuff/Desktop/test.xlsx")
    
    g1 = df.Group1
    g2 = df.Group2
    g3 = df.Group3
    g4 = df.Group4
    my_values = df.Values
    
    df = pd.DataFrame(
        dict(group1=g1, group2=g2, group3=g3, group4=g4, my_values=my_values)
    )
    
    fig = px.sunburst(df, path=['group1', 'group2', 'group3', 'group4'], values='my_values')
    
    fig.show()

Sample data can be downloaded from here: https://gofile.io/d/8djNCU

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions