How to change the colors of rings on a sunburst Plotly chart

1.2k Views Asked by At

Im currently trying to make a sunburst chart with Plotly that has four rings. I would like the first 3 inner rings to be light blue and the outer most ring to be orange.

The code I used is:

fig = px.sunburst(
    data,
    path=['column', 'column2','column3','column 4'],
    values='column4') 
fig.show()

Thank you so much for your help!

1

There are 1 best solutions below

0
On

Setting the colors of the marker should do:

In javascript :

data = [{
  type: "sunburst",
  labels: ["ring1", "ring2", "ring3", "ring4"],
  parents: ["", "ring1", "ring2", "ring3"],
  marker: {
    colors: [ "steelblue","steelblue","steelblue", "orange"]
  },
}];

Plotly.newPlot('plotlyDiv1', data);