Skip to content

Convert docstring of Axes.pie() into numpydoc #8357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ea9250d
numpydocstring added
kahnchana Mar 21, 2017
d4d912b
.
kahnchana Mar 21, 2017
ce79bfe
Merge remote-tracking branch 'refs/remotes/matplotlib/master' into do…
kahnchana Mar 22, 2017
492b0ac
Revert "numpydocstring added"
kahnchana Mar 22, 2017
50aa3ff
Docstring to Numpydoc
kahnchana Mar 22, 2017
17570af
Merge remote-tracking branch 'refs/remotes/matplotlib/master'
kahnchana Mar 22, 2017
9b6c50b
Merge remote-tracking branch 'refs/remotes/origin/master' into docstring
kahnchana Mar 22, 2017
8df19bd
FIX small nitpicks
kahnchana Mar 22, 2017
f570978
removed duplicate matplotlib.transforms import
sindunuragarp Mar 16, 2017
027cbae
Standardized matplotlib transforms import
sindunuragarp Mar 19, 2017
34f688b
Reconfigured line to comply with pep8 length
sindunuragarp Mar 20, 2017
03bacb8
Removed additional pep8 e501 error caused by mtransforms
sindunuragarp Mar 21, 2017
465a453
STY: pep8 cleanup
tacaswell Mar 10, 2017
6e451f1
MNT: explicitly pass in file handle to print_figure_impl
tacaswell Mar 10, 2017
710b509
FIX: always remove the temporary file in eps print_figure
tacaswell Mar 10, 2017
9f53b14
STY: pep8 clean up
tacaswell Mar 10, 2017
b9ff429
FIX: always remove the temporary file in eps print_figure_tex
tacaswell Mar 10, 2017
c3d012a
Revert "numpydocstring added"
kahnchana Mar 22, 2017
d12a3cd
Docstring to Numpydoc
kahnchana Mar 22, 2017
0b4909a
FIX small nitpicks
kahnchana Mar 22, 2017
8e54067
Merge branch 'docstring' of https://github.com/kahnchana/matplotlib i…
kahnchana Mar 22, 2017
a0c7bd8
Made style changes and edits suggested
kahnchana Mar 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 41 additions & 39 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,99 +2475,101 @@ def pie(self, x, explode=None, labels=None, colors=None,
startangle=None, radius=None, counterclock=True,
wedgeprops=None, textprops=None, center=(0, 0),
frame=False, rotatelabels=False):
r"""
Plot a pie chart.
r"""Plot a pie chart.

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
of x give the fractional area directly and the array will not
be normalized. The wedges are plotted counterclockwise,
by default starting from the x-axis.

Keyword arguments:
Parameters
----------
x : array
The input array used to make the pie chart.

*explode*: [ *None* | len(x) sequence ]
explode : None or array
If not *None*, is a ``len(x)`` array which specifies the
fraction of the radius with which to offset each wedge.

*colors*: [ *None* | color sequence ]
colors : None or array
A sequence of matplotlib color args through which the pie chart
will cycle. If `None`, will use the colors in the currently
active cycle.

*labels*: [ *None* | len(x) sequence of strings ]
labels : None or list
A sequence of strings providing the labels for each wedge

*autopct*: [ *None* | format string | format function ]
autopct : None or string or function
If not *None*, is a string or function used to label the wedges
with their numeric value. The label will be placed inside the
wedge. If it is a format string, the label will be ``fmt%pct``.
If it is a function, it will be called.

*pctdistance*: scalar
pctdistance : float
The ratio between the center of each pie slice and the
start of the text generated by *autopct*. Ignored if
*autopct* is *None*; default is 0.6.

*labeldistance*: scalar
labeldistance : float
The radial distance at which the pie labels are drawn

*shadow*: [ *False* | *True* ]
shadow : bool
Draw a shadow beneath the pie.

*startangle*: [ *None* | Offset angle ]
startangle : None or float
If not *None*, rotates the start of the pie chart by *angle*
degrees counterclockwise from the x-axis.

*radius*: [ *None* | scalar ]
radius : None or float
The radius of the pie, if *radius* is *None* it will be set to 1.

*counterclock*: [ *False* | *True* ]
counterclock : bool
Specify fractions direction, clockwise or counterclockwise.

*wedgeprops*: [ *None* | dict of key value pairs ]
wedgeprops : None or dict
Dict of arguments passed to the wedge objects making the pie.
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 ]
textprops : None or dict
Dict of arguments to pass to the text objects.

*center*: [ (0,0) | sequence of 2 scalars ]
Center position of the chart.

*frame*: [ *False* | *True* ]
Plot axes frame with the chart.
center : list of float
Center position of the chart. Takes value (0,0) or is a sequence
of 2 scalars.

*rotatelabels*: [ *False* | *True* ]
Rotate each label to the angle of the corresponding slice.
frame : bool
Plot axes frame with the chart if true.

The pie chart will probably look best if the figure and axes are
square, or the Axes aspect is equal. e.g.::
rotatelabels : bool
Rotate each label to the angle of the corresponding slice if true.

figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
Returns
-------
patches : list
A sequence of :class:`matplotlib.patches.Wedge` instances

or::
texts : list
A is a list of the label :class:`matplotlib.text.Text` instances.

axes(aspect=1)
autotexts : list
A is a list of :class:`~matplotlib.text.Text` instances for the
numeric labels. Is returned only if parameter *autopct* is
not *None*.

Return value:
If *autopct* is *None*, return the tuple (*patches*, *texts*):
Notes
--------
The pie chart will probably look best if the figure and axes are
square, or the Axes aspect is equal.

- *patches* is a sequence of
:class:`matplotlib.patches.Wedge` instances
>>> figure(figsize=(8,8))
>>> ax = axes([0.1, 0.1, 0.8, 0.8])

- *texts* is a list of the label
:class:`matplotlib.text.Text` instances.
>>> axes(aspect=1)

If *autopct* is not *None*, return the tuple (*patches*,
*texts*, *autotexts*), where *patches* and *texts* are as
above, and *autotexts* is a list of
:class:`~matplotlib.text.Text` instances for the numeric
labels.
"""

x = np.array(x, np.float32)
Expand Down
24 changes: 24 additions & 0 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ def create_figure():


# test compiling a figure to pdf with xelatex
<<<<<<< HEAD
@needs_xelatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_xelatex():
rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -93,9 +97,13 @@ def test_xelatex():


# test compiling a figure to pdf with pdflatex
<<<<<<< HEAD
@needs_pdflatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_pdflatex():
import os
if os.environ.get('APPVEYOR', False):
Expand All @@ -113,10 +121,14 @@ def test_pdflatex():


# test updating the rc parameters for each figure
<<<<<<< HEAD
@needs_xelatex
@needs_pdflatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_rcupdate():
rc_sets = []
rc_sets.append({'font.family': 'sans-serif',
Expand Down Expand Up @@ -145,9 +157,13 @@ def test_rcupdate():


# test backend-side clipping, since large numbers are not supported by TeX
<<<<<<< HEAD
@needs_xelatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_pathclip():
rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -162,9 +178,13 @@ def test_pathclip():


# test mixed mode rendering
<<<<<<< HEAD
@needs_xelatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_mixedmode():
rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand All @@ -177,9 +197,13 @@ def test_mixedmode():


# test bbox_inches clipping
<<<<<<< HEAD
@needs_xelatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
=======
@switch_backend('pgf')
>>>>>>> 40d5e418e... FIX small nitpicks
def test_bbox_inches():
rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
Expand Down