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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Docstring to Numpydoc
Converts the docstring of pie() function in _ axes.py into numpydoc
  • Loading branch information
kahnchana committed Mar 22, 2017
commit 50aa3ffc63b7ca9ef17ea11b8f472fe87eed13a8
81 changes: 42 additions & 39 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,99 +2475,102 @@ 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space before the colon for all parameters.

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 Offset angle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offset angle is not a type; should be 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 int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space. Also, why int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Changing to 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add space before colon of every return value.

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 is if parameter *autopct* is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is if -> if

not *None*. If *autopct* is *None*, the tuple returned
is (patches, texts).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave out this last sentence.


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