Skip to content

Commit 58fef66

Browse files
committed
align center annotations in donut pies
1 parent 743b524 commit 58fef66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: doc/python/pie-charts.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ fig.update_traces(hole=.4, hoverinfo="label+percent+name")
235235
fig.update_layout(
236236
title_text="Global Emissions 1990-2011",
237237
# Add annotations in the center of the donut pies.
238-
annotations=[dict(text='GHG', x=0.18, y=0.5, font_size=20, showarrow=False),
239-
dict(text='CO2', x=0.82, y=0.5, font_size=20, showarrow=False)])
238+
annotations=[dict(text='GHG', x=sum(fig.get_subplot(1, 1).x) / 2, y=0.5,
239+
font_size=20, showarrow=False, xanchor="center"),
240+
dict(text='CO2', x=sum(fig.get_subplot(1, 2).x) / 2, y=0.5,
241+
font_size=20, showarrow=False, xanchor="center")])
240242
fig.show()
241243
```
242244

0 commit comments

Comments
 (0)