title: How can I set the colors on a plotly sunburst chart?
body: <p>I'm using plotly to make a sunburst chart <a href="https://plot.ly/python/sunburst-charts/" rel="noreferrer">following the tutorials here</a>. My data is color words ('name'), the color hex codes ('hex'), the number of times they appear ('n'), and the parent color or color category ('parent'), with the associated hex code ('parentHex'). It looks like this: </p>
  
  <pre><code>      name      hex   n  parent parentHex
  -----------------------------------------
  0     dust  #b2996e   3  orange   #FFA500
  1      tea  #65ab7c  16    grey   #BEBEBE
  2   spruce  #0a5f38   1   black   #000000
  3   desert  #ccad60   6  orange   #FFA500
  4    swamp  #698339   2    grey   #BEBEBE
  5     fern  #63a950   1   green   #00FF00
  6    straw  #fcf679   9  yellow   #FFFF00
  7  leather  #ac7434   5  orange   #FFA500
  8    hazel  #8e7618   2  orange   #FFA500
  9      ice  #d6fffa   4   white   #FFFFFF
  
  </code></pre>
  
  <p>And my code looks like this: </p>
  
  <pre class="lang-py prettyprint-override"><code>import plotly.express as px
  
  fig = px.sunburst(dfSubset, path=['parent', 'name'], values='n', color='hex') 
  fig.show()
  </code></pre>
  
  <p>This produces a sunburst chart like the one I want, but the colors are all wrong. How can I set the colors such that the value "orange" is actually orange, and so on? </p>
  
  <p>I've also tried this: </p>
  
  <pre class="lang-py prettyprint-override"><code>fig = px.sunburst(dfSubset, path=['parent', 'name'], values='n', color='name', color_discrete_map=colorMapSubset)
  fig.show()
  </code></pre>
  
  <p>But this doesn't work, either—I get different colors, but they aren't the correct ones.</p>