vastorbit.VastColumn.range_plot¶
- VastColumn.range_plot(ts: str, 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, plot_median: bool = False, chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure¶
Draws the range plot of the VastColumn. The aggregations used to draw the plot are the median and the two user-specified quantiles.
- Parameters:
ts (str) – TS (Time Series) VastColumn used to order the data. The VastColumn 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:
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 Range Plots
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
Nto 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, "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
VastFrame.range_plot(): Range Plot.VastColumn.plot(): Line Plot.