Pie chart labels annotation arrow direction

Is there a way to change plotly pie chart label arrow direction, they are pointing always straightup

like this one?

hi @goumang
Welcome to the Community. That’s a good question. I think your answer is the rotation attribute, found on this page of the Figure reference docs.

Here is an example code:

import plotly.express as px
df = px.data.gapminder().query("year == 2007").query("continent == 'Europe'")
df.loc[df['pop'] < 2.e6, 'country'] = 'Other countries' # Represent only large countries
fig = px.pie(df, values='pop', names='country', title='Population of European continent')
1 Like

Hi,thank you for your kind reply. I tried your method, result is

but I still wonder if the label arrows can be more separated