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

Skip to content

Commit fa86275

Browse files
committed
Merge pull request #2952 from tacaswell/pie_clipping
BUG : turned clipping off on pie chart components
2 parents e0be268 + 89d8ac8 commit fa86275

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
2014-04-08 Fixed a bug in parasite_axes.py by making a list out
5252
of a generator at line 263.
5353

54+
2014-04-02 Added `clipon=False` to patch creation of wedges and shadows
55+
in `pie`.
56+
5457
2014-02-25 In backend_qt4agg changed from using update -> repaint under
5558
windows. See comment in source near `self._priv_update` for
5659
longer explaination.

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,8 +2328,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
23282328
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
23292329
autopct=None, pctdistance=0.6, shadow=False,
23302330
labeldistance=1.1, startangle=None, radius=None,
2331-
counterclock=True, wedgeprops=None, textprops=None,
2332-
)
2331+
counterclock=True, wedgeprops=None, textprops=None)
23332332
23342333
Make a pie chart of array *x*. The fractional area of each
23352334
wedge is given by x/sum(x). If sum(x) <= 1, then the values
@@ -2382,10 +2381,12 @@ def pie(self, x, explode=None, labels=None, colors=None,
23822381
For example, you can pass in wedgeprops = { 'linewidth' : 3 }
23832382
to set the width of the wedge border lines equal to 3.
23842383
For more details, look at the doc/arguments of the wedge object.
2384+
By default `clip_on=False`.
23852385
23862386
*textprops*: [ *None* | dict of key value pairs ]
23872387
Dict of arguments to pass to the text objects.
23882388
2389+
23892390
The pie chart will probably look best if the figure and axes are
23902391
square, or the Axes aspect is equal. e.g.::
23912392
@@ -2438,10 +2439,16 @@ def pie(self, x, explode=None, labels=None, colors=None,
24382439
else:
24392440
theta1 = startangle / 360.0
24402441

2442+
# set default values in wedge_prop
24412443
if wedgeprops is None:
24422444
wedgeprops = {}
2445+
if 'clip_on' not in wedgeprops:
2446+
wedgeprops['clip_on'] = False
2447+
24432448
if textprops is None:
24442449
textprops = {}
2450+
if 'clip_on' not in textprops:
2451+
textprops['clip_on'] = False
24452452

24462453
texts = []
24472454
slices = []
@@ -2467,10 +2474,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
24672474
# make sure to add a shadow after the call to
24682475
# add_patch so the figure and transform props will be
24692476
# set
2470-
shad = mpatches.Shadow(
2471-
w, -0.02, -0.02,
2472-
#props={'facecolor':w.get_facecolor()}
2473-
)
2477+
shad = mpatches.Shadow(w, -0.02, -0.02)
24742478
shad.set_zorder(0.9 * w.get_zorder())
24752479
shad.set_label('_nolegend_')
24762480
self.add_patch(shad)

0 commit comments

Comments
 (0)