Loading...

vastorbit.VastFrame.plot

VastFrame.plot(ts: str, columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | 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, kind: Literal['area_percent', 'area_stacked', 'line', 'spline', 'step'] = 'line', chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure

Draws the time series.

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, optional) – List of the VastColumns names. If empty, all numerical VastColumns are used.

  • 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.

  • kind (str, optional) –

    The plot type.

    • line:

      Line Plot.

    • spline:

      Spline Plot.

    • step:

      Step Plot.

    • area_stacked:

      Stacked Area Plot.

    • area_percent:

      Fully Stacked Area Plot.

  • chart (PlottingObject, optional) – The chart object to plot on.

  • **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 Line Plots

Let’s begin by importing vastorbit.

import vastorbit as vo

Let’s also import numpy to create a dataset.

import numpy as np

Let’s generate a dataset using the following data.

data = vo.VastFrame(
    {
        "date": [1900, 1950, 2000],
        "Asia": [947, 1402, 3634],
        "Africa": [133, 221, 767],
        "Europe": [408, 547, 729],
        "America": [156, 339, 818],
        "Oceania": [6, 13, 30],
    }
)

Below are examples of two types of plot plots:

  • Single

  • Multi

data.plot(columns = ["Asia"], ts = "date", kind = "spline")
data.plot(columns = ["Asia", "Africa", "Europe", "America", "Oceania"], ts = "date")

See also

VastFrame.range_plot() : Range Plot.
VastColumn.plot() : Line Plot.