| [ Web Proxy ] |
| Viewing: https://dataframes.bigquery.dev/reference/api/bigframes.pandas.DataFrame.area.html | [Back] [Original] |
Section Navigation
Draw a stacked area plot. An area plot displays quantitative data visually.
This function calls pandas.plot to generate a plot with a random sample of items. For consistent results, the random sampling is reproducible. Use the sampling_random_state parameter to modify the sampling seed.
Examples:
Draw an area plot based on basic business metrics:
>>> import bigframes.pandas as bpd
>>> df = bpd.DataFrame(
... {
... 'sales': [3, 2, 3, 9, 10, 6],
... 'signups': [5, 5, 6, 12, 14, 13],
... 'visits': [20, 42, 28, 62, 81, 50],
... },
... index=["01-31", "02-28", "03-31", "04-30", "05-31", "06-30"]
... )
>>> 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 = bpd.DataFrame({
... 'sales': [3, 2, 3],
... 'visits': [20, 42, 28],
... 'day': [1, 2, 3],
... })
>>> ax = df.plot.area(x='day')
x (label or position, optional) Coordinates for the X axis. By default uses the index.
y (label or position, optional) Column to plot. By default uses all columns.
stacked (bool, default True) Area plots are stacked by default. Set to False to create a unstacked plot.
sampling_n (int, default 100) Number of random items for plotting.
sampling_random_state (int, default 0) Seed for random number generator.
**kwargs Additional keyword arguments are documented in
DataFrame.plot().
Area plot, or array of area plots if subplots is True.
matplotlib.axes.Axes or numpy.ndarray
Copyright 2019, Google.
Created using Sphinx 8.1.3.
Built with the PyData Sphinx Theme 0.19.0.
| Web Proxy Viewer | New URL | Original Page |