vDataFrame.animated

In [ ]:
vDataFrame.animated(ts: str,
                    columns: list = [],
                    by: str = "",
                    start_date: (str, datetime.datetime, datetime.date,) = "",
                    end_date: (str, datetime.datetime, datetime.date,) = "",
                    kind: str = "auto",
                    limit_over: int = 6,
                    limit: int = 1000000,
                    limit_labels: int = 6,
                    ts_steps: dict = {"window": 100, "step": 5},
                    bubble_img: dict = {"bbox": [], "img": ""},
                    fixed_xy_lim: bool = False,
                    date_in_title: bool = False,
                    date_f = None,
                    date_style_dict: dict = {},
                    interval: int = 300,
                    repeat: bool = True,
                    return_html: bool = True,
                    ax=None,
                    **style_kwds,)

Draws the animated chart.

Parameters

Name Type Optional Description
ts
str
TS (Time Series) vColumn to use to order the data. The vColumn type must be date like (date, datetime, timestamp...) or numerical.
columns
list
List of the vColumns names.
by
str
Categorical vColumn used in the partition.
start_date
str / date
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
Input End Date. For example, time = '03-11-1993' will filter the data when 'ts' is greater than November 1993 the 3rd.
kind
str
Animation Type.
  • auto : Pick up automatically the type.
  • bar :Animated Bar Race.
  • bubble : Animated Bubble Plot.
  • pie : Animated Pie Chart.
  • ts : Animated Time Series.
limit_over
int
Limited number of elements to consider for each category.
limit
int
Maximum number of data points to use.
limit_labels
int
[Only used when kind = 'bubble']
Maximum number of text labels to draw.
ts_steps
dict
[Only used when kind = 'ts']
dictionary including 2 keys.
  • step: number of elements used to update the time series.
  • window: size of the window used to draw the time series.
bubble_img
dict
[Only used when kind = 'bubble']
dictionary including 2 keys.
  • img: Path to the image to display as background.
  • bbox: List of 4 elements to delimit the boundaries of the final Plot. It must be similar the following list: [xmin, xmax, ymin, ymax]
fixed_xy_lim
bool
If set to True, the xlim and ylim will be fixed.
date_in_title
bool
If set to True, the ts vColumn will be displayed in the title section.
date_f
function
Function used to display the ts vColumn.
date_style_dict
dict
Style Dictionary used to display the ts vColumn when date_in_title = False.
interval
int
Number of ms between each update.
repeat
bool
If set to True, the animation will be repeated.
return_html
bool
If set to True and if using a Jupyter notebook, the HTML of the animation will be generated.
ax
Matplotlib axes object
The axes to plot on.
**style_kwds
any
Any optional parameter to pass to the Matplotlib functions.

Returns

animation : Matplotlib animation object

Example

In [46]:
from verticapy.datasets import *
pop_growth = load_pop_growth()
amazon = load_amazon()
commodities = load_commodities()
gapminder = load_gapminder()
In [47]:
# Bar Race
pop_growth.animated("year", ["city", "population"], "continent", 1970, 1980, "bar",)
Out[47]:
In [48]:
# Animated Pie
pop_growth.animated("year", ["city", "population"], "continent", 1970, 1980, "pie",)
Out[48]:
In [50]:
# Animated TS
commodities.animated("date", kind="ts",)
Out[50]: