On this page
pandas.Series.plot.pie
Series.plot.pie(self, **kwargs)[source]-
Generate a pie plot.
A pie plot is a proportional representation of the numerical data in a column. This function wraps
matplotlib.pyplot.pie()for the specified column. If no column reference is passed andsubplots=Truea pie plot is drawn for each numerical column independently.Parameters: -
y : int or label, optional -
Label or position of the column to plot. If not provided,
subplots=Trueargument must be passed. - **kwds
-
Keyword arguments to pass on to
DataFrame.plot().
Returns: - matplotlib.axes.Axes or np.ndarray of them
-
A NumPy array is returned when
subplotsis True.
See also
Series.plot.pie- Generate a pie plot for a Series.
DataFrame.plot- Make plots of a DataFrame.
Examples
In the example below we have a DataFrame with the information about planet’s mass and radius. We pass the the ‘mass’ column to the pie function to get a pie plot.
>>> df = pd.DataFrame({'mass': [0.330, 4.87 , 5.97], ... 'radius': [2439.7, 6051.8, 6378.1]}, ... index=['Mercury', 'Venus', 'Earth']) >>> plot = df.plot.pie(y='mass', figsize=(5, 5))>>> plot = df.plot.pie(subplots=True, figsize=(6, 3)) -
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.plot.pie.html