matplotlib.pyplot.
pie
(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=None, radius=None, counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, rotatelabels=False, *, data=None)[source]¶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
resulting pie will have an empty wedge of size 1 - sum(x)
.
The wedges are plotted counterclockwise, by default starting from the x-axis.
Parameters: |
|
---|---|
Returns: |
|
Notes
The pie chart will probably look best if the figure and axes are
square, or the Axes aspect is equal.
This method sets the aspect ratio of the axis to "equal".
The axes aspect ratio can be controlled with Axes.set_aspect
.
Note
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]:
Objects passed as data must support item access (data[<arg>]
) and
membership test (<arg> in data
).