Skip to content

Commit

Permalink
Merge pull request #2952 from tacaswell/pie_clipping
Browse files Browse the repository at this point in the history
BUG : turned clipping off on pie chart components
  • Loading branch information
WeatherGod committed Jul 6, 2014
2 parents e0be268 + 89d8ac8 commit fa86275
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Expand Up @@ -51,6 +51,9 @@
2014-04-08 Fixed a bug in parasite_axes.py by making a list out
of a generator at line 263.

2014-04-02 Added `clipon=False` to patch creation of wedges and shadows
in `pie`.

2014-02-25 In backend_qt4agg changed from using update -> repaint under
windows. See comment in source near `self._priv_update` for
longer explaination.
Expand Down
16 changes: 10 additions & 6 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -2328,8 +2328,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
autopct=None, pctdistance=0.6, shadow=False,
labeldistance=1.1, startangle=None, radius=None,
counterclock=True, wedgeprops=None, textprops=None,
)
counterclock=True, wedgeprops=None, textprops=None)
Make a pie chart of array *x*. The fractional area of each
wedge is given by x/sum(x). If sum(x) <= 1, then the values
Expand Down Expand Up @@ -2382,10 +2381,12 @@ def pie(self, x, explode=None, labels=None, colors=None,
For example, you can pass in wedgeprops = { 'linewidth' : 3 }
to set the width of the wedge border lines equal to 3.
For more details, look at the doc/arguments of the wedge object.
By default `clip_on=False`.
*textprops*: [ *None* | dict of key value pairs ]
Dict of arguments to pass to the text objects.
The pie chart will probably look best if the figure and axes are
square, or the Axes aspect is equal. e.g.::
Expand Down Expand Up @@ -2438,10 +2439,16 @@ def pie(self, x, explode=None, labels=None, colors=None,
else:
theta1 = startangle / 360.0

# set default values in wedge_prop
if wedgeprops is None:
wedgeprops = {}
if 'clip_on' not in wedgeprops:
wedgeprops['clip_on'] = False

if textprops is None:
textprops = {}
if 'clip_on' not in textprops:
textprops['clip_on'] = False

texts = []
slices = []
Expand All @@ -2467,10 +2474,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
# make sure to add a shadow after the call to
# add_patch so the figure and transform props will be
# set
shad = mpatches.Shadow(
w, -0.02, -0.02,
#props={'facecolor':w.get_facecolor()}
)
shad = mpatches.Shadow(w, -0.02, -0.02)
shad.set_zorder(0.9 * w.get_zorder())
shad.set_label('_nolegend_')
self.add_patch(shad)
Expand Down

0 comments on commit fa86275

Please sign in to comment.