title: Map colors to labels in plotly go.Pie charts
body: <p>I am plotting a series of 3 pie charts using make_subplots and go.Pie. I want to eventually put these in a dash app where the user can filter the data and the figure will update. How can I map specific colors to variables so that Male is always blue, Female is always pink, etc. You can do this with plotly express with color_discrete_map but plotly express doesn't support subplots afaik.</p>
  <p>Here is an example df that I make the gender pie chart from. The other dfs have the same format just different values.</p>
  <pre><code>    Gender  ACC_ID  percent
  0   Female  57647   57.0
  1   Male    37715   37.0
  2   Other   5875    6.0
  </code></pre>
  <p>And here is the code I use to make the figures</p>
  <pre><code>fig = make_subplots(rows=1, cols=3, specs=[[{'type':'domain'}, {'type':'domain'},{'type':'domain'}]])
  fig.add_trace(go.Pie(labels=age[&quot;Age_Group&quot;], values=age[&quot;percent&quot;],customdata=age[&quot;ACC_ID&quot;], textinfo='label+percent',insidetextorientation='horizontal', textfont=dict(color='#000000'), marker_colors=px.colors.qualitative.Plotly),
                1, 1)
  fig.add_trace(go.Pie(labels=gender[&quot;Gender&quot;], values=gender[&quot;percent&quot;], customdata=gender[&quot;ACC_ID&quot;],textinfo='label+percent',insidetextorientation='horizontal',textfont=dict(color='#000000'),marker_colors=px.colors.qualitative.Plotly),
                1, 2)
  fig.add_trace(go.Pie(labels=sample[&quot;Sample_Type&quot;], values=sample[&quot;percent&quot;], customdata=sample[&quot;ACC_ID&quot;],textinfo='label+percent',texttemplate='%{label}&lt;br&gt;%{percent:.1%f}',insidetextorientation='horizontal',textfont=dict(color='#000000'),marker_colors=px.colors.qualitative.Prism),
                1, 3)
  
  
  fig.update_traces(hole=.4, hoverinfo='label+percent', hovertemplate=&quot;&lt;b&gt;%{label}&lt;/b&gt;&lt;br&gt;Percent: %{percent}&lt;br&gt;Total: %{customdata}&lt;extra&gt;&lt;/extra&gt;&quot;)
  
  fig.update_layout(
      showlegend=False,
      uniformtext_minsize=14, 
      uniformtext_mode='hide',
  
      annotations=[dict(text='Age', x=0.13, y=0.5, font_size=20, showarrow=False, font=dict(color=&quot;black&quot;)),
                   dict(text='Gender', x=0.5, y=0.5, font_size=20, showarrow=False,font=dict(color=&quot;black&quot;)),
                   dict(text='Sample', x=0.879, y=0.5, font_size=20, showarrow=False,font=dict(color=&quot;black&quot;))])
      
  
  plot(fig)
  </code></pre>