Loading...

verticapy.vDataColumn.range_plot#

vDataColumn.range_plot(ts: str, q: tuple[float, float] = (0.25, 0.75), start_date: bool | float | str | timedelta | datetime | None = None, end_date: bool | float | str | timedelta | datetime | None = None, plot_median: bool = False, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure#

Draws the range plot of the vDataColumn. The aggregations used to draw the plot are the median and the two user-specified quantiles.

Parameters#

ts: str

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

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.

plot_median: bool, optional

If set to True, the Median is drawn.

chart: PlottingObject, optional

The chart object to plot on.

**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 Range Plots

Let’s begin by importing VerticaPy.

import verticapy as vp

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 = vp.vDataFrame(
    {
        "date": [1990 + i for i in range(N)] * 5,
        "population1": [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)],
        "population2": [200 + i ** 2 - i for i in range(N)] + [1000 + i * 2 for i in range(N)] + [500 + i ** 2 - 5 * i for i in range(N)] + [900 + i ** 2 + 3 * i for i in range(N)] + [100 + i ** 2 - 0.5 * i for i in range(N)],
    }
)

Now we are ready to draw the plot:

data["population1"].range_plot(ts = "date")

See also

vDataFrame.range_plot() : Range Plot.
vDataColumn.plot() : Line Plot.