Loading...

vastorbit.VastColumn.candlestick

VastColumn.candlestick(ts: str, method: Literal[None, 'density', 'count', 'avg', 'min', 'max', 'sum'] | str = 'sum', q: tuple[float, float] = (0.25, 0.75), start_date: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, end_date: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure

Draws the Time Series of the VastColumn.

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

  • method (str, optional) –

    The method used to aggregate the data.

    • count:

      Number of elements.

    • density:

      Percentage of the distribution.

    • mean:

      Average of the VastColumns of.

    • min:

      Minimum of the VastColumns of.

    • max:

      Maximum of the VastColumns of.

    • sum:

      Sum of the VastColumns of.

    • q%:

      q Quantile of the VastColumns of (ex: 50% to get the median).

    It can also be a cutomized aggregation (ex: AVG(column1) + 5).

  • q (tuple, optional) – Tuple including the 2 quantiles used to draw the Plot.

  • start_date (str / PythonNumber / date, 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 (str / PythonNumber / date, optional) – Input End Date. For example, time = ‘03-11-1993’ will filter the data when ‘ts’ is greater than the 3rd of November 1993.

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

Let’s begin by importing vastorbit.

import vastorbit as vo

Let’s also import numpy to create a dataset.

import numpy as np

We can create a variable N to fix the size:

N = 30

Let’s generate a dataset using the following data.

data = vo.VastFrame(
    {
        "date": [1990 + i for i in range(N)] * 5,
        "population": [100 + i for i in range(N)] + [300 + i * 2 for i in range(N)] + [200 + i ** 2 - 3 * i for i in range(N)] + [50 + i ** 2 - 6 * i for i in range(N)] + [700 + i ** 2 - 10 * i for i in range(N)],
    }
)

Now we are ready to draw the plot:

data["population"].candlestick(ts = "date")

See also

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