title: Plotly express order label with a pie chart
body: <p>Let's take this sample dataframe :</p>
  <pre><code>df = pd.DataFrame({&quot;Day&quot;:['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
  'Proportion':[0.24495486, 0.17300189, 0.23019185, 0.15408692, 0.17827757,0.01100911, 0.0084778]})
  
           Day  Proportion
  0     Monday    0.244955
  1    Tuesday    0.173002
  2  Wednesday    0.230192
  3   Thursday    0.154087
  4     Friday    0.178278
  5   Saturday    0.011009
  6     Sunday    0.008478
  </code></pre>
  <p>I would like to use plotly express to visualize this dataframe through a pie chart. I've built the following function :</p>
  <pre><code>import plotly.express as px
  
  def plot_pie_graph(df_graph,col_names,col_values, title_x = &quot;axis_x&quot;,title_y=&quot;axis_y&quot;,title = &quot;Graphe&quot;,
                     color_discrete_map = {}, save_graph_name = &quot;&quot;) :
      
      if title_x == &quot;axis_x&quot; :
          title_x = col_names
      if title_y == &quot;axis_y&quot;:
          title_y = col_values
      
      fig = px.pie(df_graph, values = col_values, names = col_names,color_discrete_map=color_discrete_map,
                   color=col_names)
  
      fig.update_layout({
              'plot_bgcolor': 'rgba(0,0,0,0)',
              'paper_bgcolor': 'rgba(0,0,0,0)',
          },
          hoverlabel=dict(
              #bgcolor=&quot;white&quot;, 
              font_size=12, 
              #font_family=&quot;Rockwell&quot;
          ),
          xaxis={
              'title': title_x,
              },
          yaxis={'title':title_y},
          title={
              'text': title,
              #'y':0.95,
              'x':0.5,
              'xanchor': 'center',
              'yanchor': 'top'},
          hovermode = &quot;x&quot;
      )
      
      if save_graph_name != &quot;&quot; :
          fig.write_html(save_graph_name + &quot;.html&quot;)
      
      fig.show()
  </code></pre>
  <p>And when I use it, I got the following pie chart :</p>
  <pre><code>plot_pie_graph(df,&quot;Day&quot;,'Proportion',title = &quot;Proportion by day&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/qh5oX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qh5oX.png" alt="enter image description here" /></a></p>
  <p>Days are not ordered as in the dataframe. I saw that there is <a href="https://plotly.com/python-api-reference/generated/plotly.express.bar.html" rel="nofollow noreferrer">a parameter called &quot;category_order&quot; with bar charts</a> to deal with this issue but not available with pie charts. How please could I logically order the days in the label ?</p>