@@ -3337,19 +3337,87 @@ def kde(self, bw_method=None, ind=None, **kwds):
3337
3337
3338
3338
def area (self , x = None , y = None , ** kwds ):
3339
3339
"""
3340
- Area plot
3340
+ Draw a stacked area plot.
3341
+
3342
+ An area plot displays quantitative data visually.
3343
+ This function wraps the matplotlib area function.
3341
3344
3342
3345
Parameters
3343
3346
----------
3344
- x, y : label or position, optional
3345
- Coordinates for each point.
3346
- `**kwds` : optional
3347
+ x : label or position, optional
3348
+ Coordinates for the X axis. By default uses the index.
3349
+ y : label or position, optional
3350
+ Column to plot. By default uses all columns.
3351
+ stacked : bool, default True
3352
+ Area plots are stacked by default. Set to False to create a
3353
+ unstacked plot.
3354
+ **kwds : optional
3347
3355
Additional keyword arguments are documented in
3348
3356
:meth:`pandas.DataFrame.plot`.
3349
3357
3350
3358
Returns
3351
3359
-------
3352
- axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
3360
+ matplotlib.axes.Axes or numpy.ndarray
3361
+ Area plot, or array of area plots if subplots is True
3362
+
3363
+ See Also
3364
+ --------
3365
+ DataFrame.plot : Make plots of DataFrame using matplotlib / pylab.
3366
+
3367
+ Examples
3368
+ --------
3369
+ Draw an area plot based on basic business metrics:
3370
+
3371
+ .. plot::
3372
+ :context: close-figs
3373
+
3374
+ >>> df = pd.DataFrame({
3375
+ ... 'sales': [3, 2, 3, 9, 10, 6],
3376
+ ... 'signups': [5, 5, 6, 12, 14, 13],
3377
+ ... 'visits': [20, 42, 28, 62, 81, 50],
3378
+ ... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
3379
+ ... freq='M'))
3380
+ >>> ax = df.plot.area()
3381
+
3382
+ Area plots are stacked by default. To produce an unstacked plot,
3383
+ pass ``stacked=False``:
3384
+
3385
+ .. plot::
3386
+ :context: close-figs
3387
+
3388
+ >>> df = pd.DataFrame({
3389
+ ... 'sales': [3, 2, 3, 9, 10, 6],
3390
+ ... 'signups': [5, 5, 6, 12, 14, 13],
3391
+ ... 'visits': [20, 42, 28, 62, 81, 50],
3392
+ ... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
3393
+ ... freq='M'))
3394
+ >>> ax = df.plot.area(stacked=False)
3395
+
3396
+ Draw an area plot for each metric:
3397
+
3398
+ .. plot::
3399
+ :context: close-figs
3400
+
3401
+ >>> df = pd.DataFrame({
3402
+ ... 'sales': [3, 2, 3, 9, 10, 6],
3403
+ ... 'signups': [5, 5, 6, 12, 14, 13],
3404
+ ... 'visits': [20, 42, 28, 62, 81, 50],
3405
+ ... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
3406
+ ... freq='M'))
3407
+ >>> ax = df.plot.area(y='sales')
3408
+
3409
+ Draw with a different `x`:
3410
+
3411
+ .. plot::
3412
+ :context: close-figs
3413
+
3414
+ >>> df = pd.DataFrame({
3415
+ ... 'sales': [3, 2, 3],
3416
+ ... 'visits': [20, 42, 28],
3417
+ ... 'day': ['Monday', 'Tuesday', 'Wednesday'],
3418
+ ... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
3419
+ ... freq='M'))
3420
+ >>> ax = df.plot.area(x='day')
3353
3421
"""
3354
3422
return self (kind = 'area' , x = x , y = y , ** kwds )
3355
3423
0 commit comments