title: Order of legend plotly
body: <p>Just like a similar question asked <a href="https://stackoverflow.com/questions/56808693/customizing-the-order-of-legends-in-plotly">here</a>, I would like to change the order of the legend of a plotly pie chart. The difference is that I can't simply use <code>traceorder</code> since I have more than 6 labels and reversing them doesn't put them in the right order.</p>
  
  <p>Is there a way to customize the order?</p>
  
  <p>As an example with 4 labels:</p>
  
  <pre class="lang-py prettyprint-override"><code>import plotly.offline as py
  trace1 = go.Pie(                    
      values = [2, 4, 4, 9],                    
      labels = ['A', 'B', 'C', 'D'],
      name    = "Succes" 
  )
  
  data = [trace1]
  fig  = go.Figure(data = data)
  py.plot(fig)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/EXgMj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EXgMj.png" alt="How it&#39;s currently"></a></p>
  
  <p>I would like to prespecify the order of the legend. </p>