From a6bbc3c2cdbfa15cc4bf39e6bcf4b4379bf01320 Mon Sep 17 00:00:00 2001 From: Sergey Kholodilov Date: Fri, 28 Feb 2014 19:09:23 +0400 Subject: [PATCH 1/4] counterclock parameter for pie --- lib/matplotlib/axes/_axes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 90d9b4f2d714..7a581bd8f174 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2340,7 +2340,7 @@ def stem(self, *args, **kwargs): def pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, - labeldistance=1.1, startangle=None, radius=None): + labeldistance=1.1, startangle=None, radius=None, counterclock=True): r""" Plot a pie chart. @@ -2394,6 +2394,9 @@ def pie(self, x, explode=None, labels=None, colors=None, *radius*: [ *None* | scalar ] The radius of the pie, if *radius* is *None* it will be set to 1. + *counterclock*: [ *False* | *True* ] + Specify fractions direction, clockwise or counterclockwise. + The pie chart will probably look best if the figure and axes are square, or the Axes aspect is equal. e.g.:: @@ -2453,12 +2456,12 @@ def pie(self, x, explode=None, labels=None, colors=None, i = 0 for frac, label, expl in cbook.safezip(x, labels, explode): x, y = center - theta2 = theta1 + frac + theta2 = (theta1 + frac) if counterclock else (theta1 - frac) thetam = 2 * math.pi * 0.5 * (theta1 + theta2) x += expl * math.cos(thetam) y += expl * math.sin(thetam) - w = mpatches.Wedge((x, y), radius, 360. * theta1, 360. * theta2, + w = mpatches.Wedge((x, y), radius, 360. * min(theta1, theta2), 360. * max(theta1, theta2), facecolor=colors[i % len(colors)]) slices.append(w) self.add_patch(w) From bc608797589891ca169fa1e19d1000362f788f64 Mon Sep 17 00:00:00 2001 From: Sergey Kholodilov Date: Thu, 13 Mar 2014 19:50:29 +0400 Subject: [PATCH 2/4] fix style restriction failure --- lib/matplotlib/axes/_axes.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 7a581bd8f174..9474852a5c96 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2339,8 +2339,8 @@ def stem(self, *args, **kwargs): return stem_container def pie(self, x, explode=None, labels=None, colors=None, - autopct=None, pctdistance=0.6, shadow=False, - labeldistance=1.1, startangle=None, radius=None, counterclock=True): + autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, + startangle=None, radius=None, counterclock=True): r""" Plot a pie chart. @@ -2395,7 +2395,7 @@ def pie(self, x, explode=None, labels=None, colors=None, The radius of the pie, if *radius* is *None* it will be set to 1. *counterclock*: [ *False* | *True* ] - Specify fractions direction, clockwise or counterclockwise. + Specify fractions direction, clockwise or counterclockwise. The pie chart will probably look best if the figure and axes are square, or the Axes aspect is equal. e.g.:: @@ -2461,8 +2461,9 @@ def pie(self, x, explode=None, labels=None, colors=None, x += expl * math.cos(thetam) y += expl * math.sin(thetam) - w = mpatches.Wedge((x, y), radius, 360. * min(theta1, theta2), 360. * max(theta1, theta2), - facecolor=colors[i % len(colors)]) + w = mpatches.Wedge((x, y), radius, 360. * min(theta1, theta2), + 360. * max(theta1, theta2), + facecolor=colors[i % len(colors)]) slices.append(w) self.add_patch(w) w.set_label(label) From 73b03021602b8f2497b481d6a1e285de6e2a8772 Mon Sep 17 00:00:00 2001 From: Sergey Kholodilov Date: Thu, 13 Mar 2014 19:50:50 +0400 Subject: [PATCH 3/4] change description --- doc/api/api_changes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 4520735f709f..640e9a082bca 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -144,6 +144,8 @@ original location: tuple-like if separate axis padding is required. The original behavior is preserved. +* Added clockwise parameter to control sectors direction in `axes.pie` + .. _changes_in_1_3: From 4d374d535c6fb31e6b2f4315a73952cbe4da13f3 Mon Sep 17 00:00:00 2001 From: Sergey Kholodilov Date: Thu, 13 Mar 2014 20:24:57 +0400 Subject: [PATCH 4/4] add description in changelog --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b6e7611bd37e..e6f161149105 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +2014-03-13 Add parameter 'clockwise' to function pie, True by default. + 2014-27-02 Implemented separate horizontal/vertical axes padding to the ImageGrid in the AxesGrid toolkit pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy