Black Lives Matter. Please consider donating to Black Girls Code today.

Display order of Sunburst plot sections

The sunburst plot automatically reorders my data to display from largest wedges to smallest within each level of the plot.

I would like to maintain the original order of the data (by row) in the dataframe I am plotting. Is there any way to do this?

I just wanted to add that this indeed a major issue for my application too. I noticed that the figure json (see below) that I constructed using the python plotly interface seems to have the order I need, but what I see rendered in the browser has the sectors reorded. It will be good to see if there is any way we can control the order. In the case of the treemap plots some control on how the sectors are computed is available.


Figure({
‘data’: [{‘branchvalues’: ‘total’,
‘hoverlabel’: {‘bgcolor’: ‘white’, ‘font’: {‘color’: ‘black’, ‘size’: 10}},
‘hovertemplate’: array([’’, ‘<VII
6291 substances’, ‘’, ‘Annex VII (PC)
254 substances’,
‘’, ‘Annex VII
4718 substances’, ‘’, ‘Annex VIII
2759 substances’,
‘’, ‘Annex IX
2336 substances’, ‘’, ‘Annex X
2275 substances’],
dtype=object),
‘ids’: array([‘l0_space0’, ‘l0_<VII’, ‘l0_space1’, ‘l0_Annex VII (PC)’, ‘l0_space2’,
‘l0_Annex VII’, ‘l0_space3’, ‘l0_Annex VIII’, ‘l0_space4’,
‘l0_Annex IX’, ‘l0_space5’, ‘l0_Annex X’], dtype=object),
‘labels’: array([’’, ‘<VII’, ‘’, ‘Annex VII (PC)’, ‘’, ‘Annex VII’, ‘’, ‘Annex VIII’, ‘’,
‘Annex IX’, ‘’, ‘Annex X’], dtype=object),
‘marker’: {‘colors’: array([‘white’, ‘white’, ‘white’, ‘white’, ‘white’, ‘white’, ‘white’, ‘white’,
‘white’, ‘white’, ‘white’, ‘white’], dtype=object),
‘line’: {‘color’: array([‘white’, ‘black’, ‘white’, ‘black’, ‘white’, ‘black’, ‘white’, ‘black’,
‘white’, ‘black’, ‘white’, ‘black’], dtype=’<U5’),
‘width’: 0.2}},
‘parents’: array([’’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’], dtype=object),
‘textfont’: {‘color’: ‘black’, ‘size’: 10},
‘texttemplate’: array([’’, ‘<VII
6291 substances’, ‘’, ‘Annex VII (PC)
254 substances’,
‘’, ‘Annex VII
4718 substances’, ‘’, ‘Annex VIII
2759 substances’,
‘’, ‘Annex IX
2336 substances’, ‘’, ‘Annex X
2275 substances’],
dtype=object),
‘type’: ‘sunburst’,
‘values’: array([10, 100, 10, 100, 10, 100, 10, 100, 10, 100, 10, 100], dtype=object)}],
‘layout’: {‘margin’: {‘b’: 0, ‘l’: 0, ‘r’: 0, ‘t’: 0}, ‘template’: ‘…’}
})