Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cd7fc3f

Browse files
Merge pull request #4147 from yuji96/master
Align an annotation with the center of a donut pie
2 parents 2f88c51 + 58fef66 commit cd7fc3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎doc/python/pie-charts.md‎

Lines changed: 4 additions & 2 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /