Data type of sunburst ids and parents

The sunburst attributes description does not mention the type of data array for ‘ids’ and ‘parents’: That’s why I
started with integer ids and parent ids. But in this case the root is not displayed.

Converting ids to strings I got the right sunburst:

I’m wondering why this behaviour? Is it intended?
Maybe it should be mentioned in docs. I spent I lot of time to figure out why the root isn’t displayed in the former case.

Hi, thanks for testing sunburst

parents and ids should work with strings and numbers, but please note that in order to show the root node, one must set one (or multiple) item(s) in parents to "" - which corresponds to saying “my root node has no parents”

@etienne I know that the root parent must be set as ' ', and I did it. But with ids as numbers the root is not displayed. I’ll post a notebook in a few minute to illustrate it.

@etienne Here is the proof:

import plotly.graph_objs as go

trace = go.Sunburst(ids =  [0, 1, 2, 3, 4, 5, 6, 7, 8],
                    labels = ["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
                    parents = ["", 0, 0, 2, 2, 0, 0, 6, 0],
                    #parents=["", "0", "0", "2", "2", "0", "0", "6", "0"],

layout = go.Layout(height=500)

fw = go.FigureWidget([trace], layout)


fw1=go.FigureWidget(fw)[0].update(parents=["", "0", "0", "2", "2", "0", "0", "6", "0" ])


Thanks for the report. We’re not handling the number 0 properly at the moment.

We’ll have a fix out in the next release.

1 Like

Is there any specific way ids parameter should be structured? I have had no luck with multiple combinations of it.

I’m feeding in a df and I’ve structured every row as below
’ ids | parent | label | value
“EP” “” “EP” 100
“EP - project 1” "EP " Project 1 45