Plot a pie chart. Make a pie chart of array *x*. The fractional area of each wedge is given by ``x/sum(x)``. The wedges are plotted counterclockwise, by default starting from the x-axis. Parameters ---------- x : 1D array-like
(self, x, explode=None, labels=None, colors=None,
autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1,
startangle=0, radius=1, counterclock=True,
wedgeprops=None, textprops=None, center=(0, 0),
frame=False, rotatelabels=False, *, normalize=True, hatch=None)
| 3537 | @_api.make_keyword_only("3.10", "explode") |
| 3538 | @_preprocess_data(replace_names=["x", "explode", "labels", "colors"]) |
| 3539 | def pie(self, x, explode=None, labels=None, colors=None, |
| 3540 | autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, |
| 3541 | startangle=0, radius=1, counterclock=True, |
| 3542 | wedgeprops=None, textprops=None, center=(0, 0), |
| 3543 | frame=False, rotatelabels=False, *, normalize=True, hatch=None): |
| 3544 | """ |
| 3545 | Plot a pie chart. |
| 3546 | |
| 3547 | Make a pie chart of array *x*. The fractional area of each wedge is |
| 3548 | given by ``x/sum(x)``. |
| 3549 | |
| 3550 | The wedges are plotted counterclockwise, by default starting from the |
| 3551 | x-axis. |
| 3552 | |
| 3553 | Parameters |
| 3554 | ---------- |
| 3555 | x : 1D array-like |
| 3556 | The wedge sizes. |
| 3557 | |
| 3558 | explode : array-like, default: None |
| 3559 | If not *None*, is a ``len(x)`` array which specifies the fraction |
| 3560 | of the radius with which to offset each wedge. |
| 3561 | |
| 3562 | labels : list, default: None |
| 3563 | A sequence of strings providing the labels for each wedge |
| 3564 | |
| 3565 | colors : :mpltype:`color` or list of :mpltype:`color`, default: None |
| 3566 | A sequence of colors through which the pie chart will cycle. If |
| 3567 | *None*, will use the colors in the currently active cycle. |
| 3568 | |
| 3569 | hatch : str or list, default: None |
| 3570 | Hatching pattern applied to all pie wedges or sequence of patterns |
| 3571 | through which the chart will cycle. For a list of valid patterns, |
| 3572 | see :doc:`/gallery/shapes_and_collections/hatch_style_reference`. |
| 3573 | |
| 3574 | .. versionadded:: 3.7 |
| 3575 | |
| 3576 | autopct : None or str or callable, default: None |
| 3577 | If not *None*, *autopct* is a string or function used to label the |
| 3578 | wedges with their numeric value. The label will be placed inside |
| 3579 | the wedge. If *autopct* is a format string, the label will be |
| 3580 | ``fmt % pct``. If *autopct* is a function, then it will be called. |
| 3581 | |
| 3582 | pctdistance : float, default: 0.6 |
| 3583 | The relative distance along the radius at which the text |
| 3584 | generated by *autopct* is drawn. To draw the text outside the pie, |
| 3585 | set *pctdistance* > 1. This parameter is ignored if *autopct* is |
| 3586 | ``None``. |
| 3587 | |
| 3588 | labeldistance : float or None, default: 1.1 |
| 3589 | The relative distance along the radius at which the labels are |
| 3590 | drawn. To draw the labels inside the pie, set *labeldistance* < 1. |
| 3591 | If set to ``None``, labels are not drawn but are still stored for |
| 3592 | use in `.legend`. |
| 3593 | |
| 3594 | shadow : bool or dict, default: False |
| 3595 | If bool, whether to draw a shadow beneath the pie. If dict, draw a shadow |
| 3596 | passing the properties in the dict to `.Shadow`. |