@@ -2478,92 +2478,95 @@ def pie(self, x, explode=None, labels=None, colors=None,
24782478 Plot a pie chart.
24792479
24802480 Make a pie chart of array *x*. The fractional area of each
2481- wedge is given by x/sum(x). If sum(x) <= 1, then the values
2482- of x give the fractional area directly and the array will not
2483- be normalized. The wedges are plotted counterclockwise,
2484- by default starting from the x-axis.
2481+ wedge is given by `` x/sum(x)`` . If `` sum(x) <= 1`` , then the
2482+ values of x give the fractional area directly and the array
2483+ will not be normalized. The wedges are plotted
2484+ counterclockwise, by default starting from the x-axis.
24852485
2486- Keyword arguments:
2486+ Parameters
2487+ ----------
2488+ x : array-like
2489+ The input array used to make the pie chart.
24872490
2488- * explode*: [ *None* | len(x) sequence ]
2491+ explode : array-like, optional, default: None
24892492 If not *None*, is a ``len(x)`` array which specifies the
24902493 fraction of the radius with which to offset each wedge.
24912494
2492- *colors*: [ *None* | color sequence ]
2495+ labels : list, optional, default: None
2496+ A sequence of strings providing the labels for each wedge
2497+
2498+ colors : array-like, optional, default: None
24932499 A sequence of matplotlib color args through which the pie chart
24942500 will cycle. If `None`, will use the colors in the currently
24952501 active cycle.
24962502
2497- *labels*: [ *None* | len(x) sequence of strings ]
2498- A sequence of strings providing the labels for each wedge
2499-
2500- *autopct*: [ *None* | format string | format function ]
2503+ autopct : None (default), string, or function, optional
25012504 If not *None*, is a string or function used to label the wedges
25022505 with their numeric value. The label will be placed inside the
25032506 wedge. If it is a format string, the label will be ``fmt%pct``.
25042507 If it is a function, it will be called.
25052508
2506- *pctdistance*: scalar
2509+ pctdistance : float, optional, default: 0.6
25072510 The ratio between the center of each pie slice and the
25082511 start of the text generated by *autopct*. Ignored if
2509- *autopct* is *None*; default is 0.6.
2510-
2511- *labeldistance*: scalar
2512- The radial distance at which the pie labels are drawn
2512+ *autopct* is *None*.
25132513
2514- * shadow*: [ *False* | *True* ]
2514+ shadow : bool, optional, default: False
25152515 Draw a shadow beneath the pie.
25162516
2517- *startangle*: [ *None* | Offset angle ]
2517+ labeldistance : float, optional, default: 1.1
2518+ The radial distance at which the pie labels are drawn
2519+
2520+ startangle : float, optional, default: None
25182521 If not *None*, rotates the start of the pie chart by *angle*
25192522 degrees counterclockwise from the x-axis.
25202523
2521- * radius*: [ *None* | scalar ]
2522- The radius of the pie, if *radius* is *None* it will be set to 1.
2524+ radius : float, optional, default: None
2525+ The radius of the pie, if *radius* is *None* it will be set to 1.
25232526
2524- * counterclock*: [ *False* | * True* ]
2527+ counterclock : bool, optional, default: True
25252528 Specify fractions direction, clockwise or counterclockwise.
25262529
2527- * wedgeprops*: [ *None* | dict of key value pairs ]
2530+ wedgeprops : dict, optional, default: None
25282531 Dict of arguments passed to the wedge objects making the pie.
2529- For example, you can pass in wedgeprops = { 'linewidth' : 3 }
2532+ For example, you can pass in`` wedgeprops = {'linewidth': 3}``
25302533 to set the width of the wedge border lines equal to 3.
25312534 For more details, look at the doc/arguments of the wedge object.
2532- By default `clip_on=False`.
2535+ By default `` clip_on=False` `.
25332536
2534- * textprops*: [ *None* | dict of key value pairs ]
2537+ textprops : dict, optional, default: None
25352538 Dict of arguments to pass to the text objects.
25362539
2537- *center*: [ (0,0) | sequence of 2 scalars ]
2538- Center position of the chart.
2540+ center : list of float, optional, default: (0, 0)
2541+ Center position of the chart. Takes value (0, 0) or is a
2542+ sequence of 2 scalars.
25392543
2540- * frame*: [ *False* | *True* ]
2541- Plot axes frame with the chart.
2544+ frame : bool, optional, default: False
2545+ Plot axes frame with the chart if true .
25422546
2543- The pie chart will probably look best if the figure and axes are
2544- square, or the Axes aspect is equal. e.g.::
2545-
2546- figure(figsize=(8,8))
2547- ax = axes([0.1, 0.1, 0.8, 0.8])
2547+ Returns
2548+ -------
2549+ patches : list
2550+ A sequence of :class:`matplotlib.patches.Wedge` instances
25482551
2549- or::
2552+ texts : list
2553+ A is a list of the label :class:`matplotlib.text.Text` instances.
25502554
2551- axes(aspect=1)
2555+ autotexts : list
2556+ A is a list of :class:`~matplotlib.text.Text` instances for the
2557+ numeric labels. Is returned only if parameter *autopct* is
2558+ not *None*.
25522559
2553- Return value:
2554- If *autopct* is *None*, return the tuple (*patches*, *texts*):
2560+ Notes
2561+ -----
2562+ The pie chart will probably look best if the figure and axes are
2563+ square, or the Axes aspect is equal.
25552564
2556- - *patches* is a sequence of
2557- :class:`matplotlib.patches.Wedge` instances
2565+ Examples
2566+ --------
2567+ .. plot:: mpl_examples/pie_and_polar_charts/pie_demo_features.py
25582568
2559- - *texts* is a list of the label
2560- :class:`matplotlib.text.Text` instances.
25612569
2562- If *autopct* is not *None*, return the tuple (*patches*,
2563- *texts*, *autotexts*), where *patches* and *texts* are as
2564- above, and *autotexts* is a list of
2565- :class:`~matplotlib.text.Text` instances for the numeric
2566- labels.
25672570 """
25682571
25692572 x = np .asarray (x ).astype (np .float32 )
@@ -2621,9 +2624,9 @@ def get_next_color():
26212624 y += expl * math .sin (thetam )
26222625
26232626 w = mpatches .Wedge ((x , y ), radius , 360. * min (theta1 , theta2 ),
2624- 360. * max (theta1 , theta2 ),
2625- facecolor = get_next_color (),
2626- ** wedgeprops )
2627+ 360. * max (theta1 , theta2 ),
2628+ facecolor = get_next_color (),
2629+ ** wedgeprops )
26272630 slices .append (w )
26282631 self .add_patch (w )
26292632 w .set_label (label )
@@ -2674,9 +2677,9 @@ def get_next_color():
26742677 self .set_frame_on (False )
26752678
26762679 self .set_xlim ((- 1.25 + center [0 ],
2677- 1.25 + center [0 ]))
2680+ 1.25 + center [0 ]))
26782681 self .set_ylim ((- 1.25 + center [1 ],
2679- 1.25 + center [1 ]))
2682+ 1.25 + center [1 ]))
26802683 self .set_xticks ([])
26812684 self .set_yticks ([])
26822685
0 commit comments