Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Help with Sunburst using Plotly Express and path

$
0
0

@AnnMarieW wrote:

Hi

Plotly Express with the path argument makes it really easy to create Sunburst Charts. Thanks for this new addition in 4.5!

I have 2 questions:

In the function below, the column names for the path are updated from a dropdown. I would like to include a description for the column in the hovertemplate. For example, if you hover over UK I would like it to show “United Kingdom” I tried using names= with the column name that contains the descriptions, but I couldn’t get it to work. An example would be really helpful.

Also, if the values are zero the labels show up in very strange looking overlapping text. How do I get rid of that? I’m using: uniformtext=dict(minsize=10, mode=‘hide’) but it only seems to hide small non-zero values.

def make_sunburst(wb, balance, path):
    figure = px.sunburst(wb, path=path, values=balance)    
    figure.update_traces(
        go.Sunburst(hovertemplate=' $: %{value}'),
        insidetextorientation='radial',       
    )
    figure.update_layout(
        margin=dict(t=10, l=0, r=0, b=0),                        
        uniformtext=dict(minsize=10, mode='hide'),
        paper_bgcolor='whitesmoke'
    )   
    return figure

Posts: 7

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles