Setting the order of elements within a piechart

Hi I am graphuing multiple piecharts from one and the same dataframe and would like the order of display of the elements within the graphs to be identical.

For example using an the code from the plotly piecharts examples :

import plotly.graph_objects as go
from plotly.subplots import make_subplots

labels = [“Asia”, “Europe”, “Africa”, “Americas”, “Oceania”]

fig = make_subplots(1, 2, specs=[[{‘type’:‘domain’}, {‘type’:‘domain’}]],
subplot_titles=[‘1980’, ‘2007’])
fig.add_trace(go.Pie(labels=labels, values=[4, 7, 1, 7, 0.5], scalegroup=‘one’,
name=“World GDP 1980”), 1, 1)
fig.add_trace(go.Pie(labels=labels, values=[21, 15, 3, 19, 1], scalegroup=‘one’,
name=“World GDP 2007”), 1, 2)

fig.update_layout(title_text=‘World GDP’)
fig.show()
In this example I would like the values for Europe to always be displayed ont he upper right side of the piechart

Yeah this has happened to me too.

Just add “sort=False” in the go.Pie attributes

For example:

labels = [“Asia”, “Europe”, “Africa”, “Americas”, “Oceania”]
fig = make_subplots(1, 2, specs=[[{‘type’:‘domain’}, {‘type’:‘domain’}]],
subplot_titles=[‘1980’, ‘2007’])
fig.add_trace(go.Pie(labels=labels, values=[4, 7, 1, 7, 0.5],sort=False, scalegroup=‘one’,name=“World GDP 1980”), 1, 1)
fig.add_trace(go.Pie(labels=labels, values=[21, 15, 3, 19, 1],sort=False, scalegroup=‘one’,name=“World GDP 2007”), 1, 2)

Thank you very much, I applied your solution and it worked