8000 Merge pull request #10150 from timhoffm/axes-plotting-docstrings · matplotlib/matplotlib@f4d845b · GitHub
[go: up one dir, main page]

Skip to content

Commit f4d845b

Browse files
authored
Merge pull request #10150 from timhoffm/axes-plotting-docstrings
Docstring updates for `Axes.fill` and `Axes.pie`
2 parents d80671b + 4ac0dd1 commit f4d845b

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,30 +2537,32 @@ def pie(self, x, explode=None, labels=None, colors=None,
25372537
startangle=None, radius=None, counterclock=True,
25382538
wedgeprops=None, textprops=None, center=(0, 0),
25392539
frame=False, rotatelabels=False):
2540-
r"""
2540+
"""
25412541
Plot a pie chart.
25422542
2543-
Make a pie chart of array *x*. The fractional area of each
2544-
wedge is given by ``x/sum(x)``. If ``sum(x) <= 1``, then the
2545-
values of x give the fractional area directly and the array
2546-
will not be normalized. The wedges are plotted
2547-
counterclockwise, by default starting from the x-axis.
2543+
Make a pie chart of array *x*. The fractional area of each wedge is
2544+
given by ``x/sum(x)``. If ``sum(x) < 1``, then the values of *x* give
2545+
the fractional area directly and the array will not be normalized. The
2546+
resulting pie will have an empty wedge of size ``1 - sum(x)``.
2547+
2548+
The wedges are plotted counterclockwise, by default starting from the
2549+
x-axis.
25482550
25492551
Parameters
25502552
----------
25512553
x : array-like
2552-
The input array used to make the pie chart.
2554+
The wedge sizes.
25532555
25542556
explode : array-like, optional, default: None
2555-
If not *None*, is a ``len(x)`` array which specifies the
2556-
fraction of the radius with which to offset each wedge.
2557+
If not *None*, is a ``len(x)`` array which specifies the fraction
2558+
of the radius with which to offset each wedge.
25572559
25582560
labels : list, optional, default: None
25592561
A sequence of strings providing the labels for each wedge
25602562
25612563
colors : array-like, optional, default: None
25622564
A sequence of matplotlib color args through which the pie chart
2563-
will cycle. If `None`, will use the colors in the currently
2565+
will cycle. If *None*, will use the colors in the currently
25642566
active cycle.
25652567
25662568
autopct : None (default), string, or function, optional
@@ -2570,9 +2572,8 @@ def pie(self, x, explode=None, labels=None, colors=None,
25702572
If it is a function, it will be called.
25712573
25722574
pctdistance : float, optional, default: 0.6
2573-
The ratio between the center of each pie slice and the
2574-
start of the text generated by *autopct*. Ignored if
2575-
*autopct* is *None*.
2575+
The ratio between the center of each pie slice and the start of
2576+
the text generated by *autopct*. Ignored if *autopct* is *None*.
25762577
25772578
shadow : bool, optional, default: False
25782579
Draw a shadow beneath the pie.
@@ -2592,7 +2593,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
25922593
25932594
wedgeprops : dict, optional, default: None
25942595
Dict of arguments passed to the wedge objects making the pie.
2595-
For example, you can pass in``wedgeprops = {'linewidth': 3}``
2596+
For example, you can pass in ``wedgeprops = {'linewidth': 3}``
25962597
to set the width of the wedge border lines equal to 3.
25972598
For more details, look at the doc/arguments of the wedge object.
25982599
By default ``clip_on=False``.
@@ -2601,8 +2602,8 @@ def pie(self, x, explode=None, labels=None, colors=None,
26012602
Dict of arguments to pass to the text objects.
26022603
26032604
center : list of float, optional, default: (0, 0)
2604-
Center position of the chart. Takes value (0, 0) or is a
2605-
sequence of 2 scalars.
2605+
Center position of the chart. Takes value (0, 0) or is a sequence
2606+
of 2 scalars.
26062607
26072608
frame : bool, optional, default: False
26082609
Plot axes frame with the chart if true.
@@ -2616,11 +2617,11 @@ def pie(self, x, explode=None, labels=None, colors=None,
26162617
A sequence of :class:`matplotlib.patches.Wedge` instances
26172618
26182619
texts : list
2619-
A is a list of the label :class:`matplotlib.text.Text` instances.
2620+
A list of the label :class:`matplotlib.text.Text` instances.
26202621
26212622
autotexts : list
2622-
A is a list of :class:`~matplotlib.text.Text` instances for the
2623-
numeric labels. Is returned only if parameter *autopct* is
2623+
A list of :class:`~matplotlib.text.Text` instances for the numeric
2624+
labels. This will only be returned if the parameter *autopct* is
26242625
not *None*.
26252626
26262627
Notes
@@ -4715,34 +4716,35 @@ def fill(self, *args, **kwargs):
47154716
47164717
Parameters
47174718
----------
4718-
args : a variable length argument
4719-
It allowing for multiple
4720-
*x*, *y* pairs with an optional color format string; see
4721-
:func:`~matplotlib.pyplot.plot` for details on the argument
4722-
parsing. For example, each of the following is legal::
4719+
args : sequence of x, y, [color]
4720+
Each polygon is defined by the lists of *x* and *y* positions of
4721+
its nodes, optionally followed by by a *color* specifier. See
4722+
:mod:`matplotlib.colors` for supported color specifiers. The
4723+
standard color cycle is used for polygons without a color
4724+
specifier.
47234725
4724-
ax.fill(x, y)
4725-
ax.fill(x, y, "b")
4726-
ax.fill(x, y, "b", x, y, "r")
4726+
You can plot multiple polygons by providing multiple *x*, *y*,
4727+
*[color]* groups.
47274728
4728-
An arbitrary number of *x*, *y*, *color* groups can be specified::
4729-
ax.fill(x1, y1, 'g', x2, y2, 'r')
4729+
For example, each of the following is legal::
4730+
4731+
ax.fill(x, y) # a polygon with default color
4732+
ax.fill(x, y, "b") # a blue polygon
4733+
ax.fill(x, y, x2, y2) # two polygons
4734+
ax.fill(x, y, "b", x2, y2, "r") # a blue and a red polygon
47304735
47314736
Returns
47324737
-------
4733-
a list of :class:`~matplotlib.patches.Patch`
4738+
a list of :class:`~matplotlib.patches.Polygon`
47344739
47354740
Other Parameters
47364741
----------------
47374742
**kwargs : :class:`~matplotlib.patches.Polygon` properties
47384743
47394744
Notes
47404745
-----
4741-
The same color strings that :func:`~matplotlib.pyplot.plot`
4742-
supports are supported by the fill format string.
4743-
4744-
If you would like to fill below a curve, e.g., shade a region
4745-
between 0 and *y* along *x*, use :meth:`fill_between`
4746+
Use :meth:`fill_between` if you would like to fill the region between
4747+
two curves.
47464748
47474749
47484750
"""

0 commit comments

Comments
 (0)
0