Series.plot.area(self, x=None, y=None, **kwargs)
[source]
Draw a stacked area plot.
An area plot displays quantitative data visually. This function wraps the matplotlib area function.
Parameters: |
|
---|---|
Returns: |
|
See also
DataFrame.plot
Draw an area plot based on basic business metrics:
>>> df = pd.DataFrame({ ... 'sales': [3, 2, 3, 9, 10, 6], ... 'signups': [5, 5, 6, 12, 14, 13], ... 'visits': [20, 42, 28, 62, 81, 50], ... }, index=pd.date_range(start='2018/01/01', end='2018/07/01', ... freq='M')) >>> ax = df.plot.area()
Area plots are stacked by default. To produce an unstacked plot, pass stacked=False
:
>>> ax = df.plot.area(stacked=False)
Draw an area plot for a single column:
>>> ax = df.plot.area(y='sales')
Draw with a different x
:
>>> df = pd.DataFrame({ ... 'sales': [3, 2, 3], ... 'visits': [20, 42, 28], ... 'day': [1, 2, 3], ... }) >>> ax = df.plot.area(x='day')
© 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.area.html