From 89d8ac87d7e5d0e03a8e00d7ef34b1bb8ef55ad3 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 2 Apr 2014 23:25:17 -0400 Subject: [PATCH] BUG : turned clipping off on pie chart components - set default value of `clip_on` in *prop dicts - closes #2518 --- CHANGELOG | 3 +++ lib/matplotlib/axes/_axes.py | 16 ++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1b24d88f661d..b138f4997978 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -40,6 +40,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. diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 90c14a172ea8..9180a35a7725 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -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 @@ -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.:: @@ -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 = [] @@ -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)