vDataFrame.stacked_area

In [ ]:
vDataFrame.stacked_area(ts: str,
                        columns: list = [],
                        start_date: (str, datetime.datetime, datetime.date, float,) = "",
                        end_date: (str, datetime.datetime, datetime.date, float,) = "",
                        fully: bool = False,
                        ax=None,
                        **style_kwds,)

Draws the stacked area chart from a time series.

Parameters

Name Type Optional Description
ts
str
❌
The time series vcolumn used to order the data. The vcolumn's type must be date-like (date, datetime, timestamp...) or numerical.
columns
list
✓
List of the vcolumns names. If empty, all the numerical vcolumns will be used. They must all include only positive values.
start_date
str / date / float
✓
Input Start Date. For example, time = '03-11-1993' will filter the data when 'ts' is lesser than November 1993 the 3rd.
end_date
str / date / float
✓
Input End Date. For example, time = '03-11-1993' will filter the data when 'ts' is greater than November 1993 the 3rd.
fully
bool
✓
If set to True, a Fully Stacked Area Chart will be drawn.
ax
Matplotlib axes object
✓
The axes to plot on.
**style_kwds
any
✓
Any optional parameter to pass to the Matplotlib functions.

Returns

ax : Matplotlib axes object

Example

In [20]:
from verticapy import *

world_pop = tablesample({"date": [1900, 1950, 2000],
                         "Asia": [947, 1402, 3634],
                         "Africa": [133, 221, 767],
                         "Europe": [408, 547, 729], 
                         "America": [156, 339, 818],
                         "Oceania": [6, 13, 30],}).to_vdf()
display(world_pop)
123
date
Int
123
Asia
Int
123
Africa
Int
123
Europe
Int
123
America
Int
123
Oceania
Int
119009471334081566
21950140222154733913
32000363476772981830
Rows: 1-3 | Columns: 6
In [25]:
# Stacked Area
world_pop.stacked_area(ts = "date", 
                       columns = ["Asia",
                                  "Africa",
                                  "Europe",
                                  "America",
                                  "Oceania",])
Out[25]:
<AxesSubplot:xlabel='"date"'>
In [26]:
# Fully Stacked Area
world_pop.stacked_area(ts = "date", 
                       columns = ["Asia",
                                  "Africa",
                                  "Europe",
                                  "America",
                                  "Oceania",],
                      fully = True)
Out[26]:
<AxesSubplot:xlabel='"date"'>

See Also

vDataFrame.plot Draws the Time Series.
vDataFrame[].plot Draws the Time Series of one vcolumn.