Loading...

vastorbit.VastFrame.animated_bar

VastFrame.animated_bar(ts: str, columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'], by: str | None = None, start_date: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, end_date: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | 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 | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure

Draws the animated bar chart (bar race).

Parameters:
  • ts (str) – TS (Time Series) VastColumn used to order the data. The VastColumn type must be date (date, datetime, timestamp…) or numerical.

  • columns (SQLColumns) – List of the VastColumns names.

  • by (str, optional) – Categorical VastColumn 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 VastColumn is displayed in the title section.

  • date_f (function, optional) – Function used to display the ts VastColumn.

  • date_style_dict (dict, optional) – Style Dictionary used to display the ts VastColumn 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:

Plotting Object.

Return type:

obj

Examples

Note

The below example is a very basic one. For other more detailed examples and customization options, please see Animated Plots

Let’s begin by importing vastorbit.

import vastorbit as vo
import vastorbit.datasets as vod

Let’s import the dataset:

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

See also

VastFrame.animated_pie() : Animated Pie Chart.
VastColumn.bar() : Bar Chart.