Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05c8058

Browse files
committed
Correct label location in pie chart. Thanks Benoit Hirbec!
svn path=/trunk/matplotlib/; revision=5502
1 parent 4d3348e commit 05c8058

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2008-06-13 Change pie chart label alignment to avoid having labels
2+
overwrite the pie - MGD
3+
14
2008-06-12 Added some helper functions to the mathtext parser to
25
return bitmap arrays or write pngs to make it easier to use
36
mathtext outside the context of an mpl figure. modified

lib/matplotlib/axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3953,10 +3953,11 @@ def pie(self, x, explode=None, labels=None, colors=None,
39533953

39543954
xt = x + labeldistance*radius*math.cos(thetam)
39553955
yt = y + labeldistance*radius*math.sin(thetam)
3956+
label_alignment = xt > 0 and 'left' or 'right'
39563957

39573958
t = self.text(xt, yt, label,
39583959
size=rcParams['xtick.labelsize'],
3959-
horizontalalignment='center',
3960+
horizontalalignment=label_alignment,
39603961
verticalalignment='center')
39613962

39623963
texts.append(t)

0 commit comments

Comments
 (0)