Sunburst Chart Edit Text


I’m very new to plotly which is great btw! I have been playing with the Sunburst chart.

Apologies if this is a repost but I can’t find a similar topic in the forums.

I seem to be having issues with the text alignments.

When I set “insidetextorientation”: ‘horizontal’

  • Some texts are not in the center but rather in the top

When I set “insidetextorientation”: ‘radial’

  • I notice that the most left left will be horizontal and not follow the rest (radial)

Also, I would like to keep my font color uniform but I can’t seem to figure out how to modify the texts inside the sunburst chart.

Language: Javascript

Code Snippet:

            Plotly.d3.csv("./dom.csv", function(err, rows){
              function unpack(rows, key) {
              return {return row[key]})
            var data = [
              "type": "sunburst",
              "maxdepth": 2,
              //"ids": unpack(rows, 'ids'),
              "labels": unpack(rows, 'labels'),
              "parents": unpack(rows, 'parents'),
              "values":  unpack(rows, 'values'),
              //"leaf": {"opacity": 0.4},
              //"marker": {"line": {"width": 2}},
              "branchvalues": 'total',
              //"textposition": 'inside',
              "insidetextorientation": 'radial' //tried changing to horizontal but some text aren't centered
            var layout = {
              margin: {l: 0, r: 0, b: 0, t:0}
            Plotly.newPlot('myDiv', data, layout, {displaylogo: false})


Thanks for using plotly.
To set a color you could use textfont.color

And in regard with the text position, just opened this issue:

Thanks archmoj! I’ll go ahead and try.

Are you able to provide an example of how this should be configured with the code I have above?

Here is a demo.

Thanks archmoj! It’s working for me now, however, the data on hover is still black, is there a separate config for that?

Could you please share a screenshot?

I seem to be having issues with attaching a screenshot.

On the demo you have provided, if you hover over on “Seth” the label is in black text. The rest has a white text when you hover over the rest.

One could set layout.bordercolor and layout.hoverlabel.color similar to this demo.

Perfect! I got it working as intented now! Thank you very much.

I have other queries but this will do for now. You’ve opened another case for my other question so we can probably close this topic?

Let’s keep this open regarding the opened plotly.js issue to center the text.