Loading...

verticapy.vDataFrame.animated_bar#

vDataFrame.animated_bar(ts: str, columns: str | list[str], by: str | None = None, start_date: bool | float | str | timedelta | datetime | None = None, end_date: bool | float | str | timedelta | datetime | None = None, limit_over: int = 6, limit: int = 1000000, fixed_xy_lim: bool = False, date_in_title: bool = False, date_f: Callable | None = None, date_style_dict: dict | None = None, interval: int = 300, repeat: bool = True, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure#

Draws the animated bar chart (bar race).

Parameters#

ts: str

TS (Time Series) vDataColumn used to order the data. The vDataColumn type must be date (date, datetime, timestamp…) or numerical.

columns: SQLColumns

List of the vDataColumns names.

by: str, optional

Categorical vDataColumn used in the partition.

start_date: PythonScalar, optional

Input Start Date. For example, time = ‘03-11-1993’ will filter the data when ‘ts’ is less than the 3rd of November 1993.

end_date: PythonScalar, optional

Input End Date. For example, time = ‘03-11-1993’ will filter the data when ‘ts’ is greater than the 3rd of November 1993.

limit_over: int, optional

Limits the number of elements to consider for each category.

limit: int, optional

Maximum number of data points to use.

fixed_xy_lim: bool, optional

If set to True, the xlim and ylim are fixed.

date_in_title: bool, optional

If set to True, the ts vDataColumn is displayed in the title section.

date_f: function, optional

Function used to display the ts vDataColumn.

date_style_dict: dict, optional

Style Dictionary used to display the ts vDataColumn when date_in_title = False.

interval: int, optional

Number of ms between each update.

repeat: bool, optional

If set to True, the animation is repeated.

chart: PlottingObject, optional

The chart object used to plot.

**style_kwargs

Any optional parameter to pass to the plotting functions.

Returns#

obj

Plotting Object.

Examples#

Note

The below example is a very basic one. For other more detailed examples and customization options, please see :ref:`chart_gallery.animated`_

Let’s begin by importing VerticaPy.

import verticapy as vp

import verticapy.datasets as vpd

Let’s import the dataset:

pop_growth = vpd.load_pop_growth()
pop_growth.animated_bar(
  ts = "year",
  columns = ["city", "population"],
  by = "continent",
  start_date = 1970,
  end_date = 1980,
)

See also

vDataFrame.animated_pie() : Animated Pie Chart.
vDataColumn.bar() : Bar Chart.