Skip to content

Commit f4b4dd1

Browse files
added pie labeling example (rev2)
1 parent df2c889 commit f4b4dd1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/pie_and_polar_charts/pie_and_donut_labels.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
fig.subplots_adjust(top=0.92, bottom=0.08)
2323
plt.setp((ax, ax2), aspect="equal")
2424

25-
###############################################################################
25+
2626
# Now it's time for the pie. Starting with a pie recipe, we create the data
2727
# and a list of labels from it.
2828
#
@@ -69,7 +69,6 @@ def func(pct, allvals):
6969
ax.set_title("Matplotlib bakery: A pie")
7070

7171

72-
###############################################################################
7372
# Now it's time for the donut. Starting with a donut recipe, we transcribe
7473
# the data to numbers (converting 1 egg to 50 g), and directly plot the pie.
7574
# The pie? Wait... it's going to be donut, is it not?
@@ -113,10 +112,10 @@ def func(pct, allvals):
113112
x = np.cos(np.deg2rad(ang))
114113
horizontalalignment = ["", "left", "right"][int(np.sign(x))]
115114
connectionstyle = "angle,angleA=0,angleB={}".format(ang)
116-
kw["arrowprops"].update({"connectionstyle":connectionstyle})
115+
kw["arrowprops"].update({"connectionstyle": connectionstyle})
117116
ax2.annotate(recipe[i], xy=(x, y), xytext=(1.35*np.sign(x), 1.4*y),
118117
horizontalalignment=horizontalalignment, **kw)
119118

120119
ax2.set_title("Matplotlib bakery: A donut")
121120

122-
plt.show()
121+
plt.show()

0 commit comments

Comments
 (0)