verticapy.vDataFrame.plot#
- vDataFrame.plot(ts: str, columns: str | list[str] | None = None, start_date: bool | float | str | timedelta | datetime | None = None, end_date: bool | float | str | timedelta | datetime | None = None, kind: Literal['area_percent', 'area_stacked', 'line', 'spline', 'step'] = 'line', chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure #
Draws the time series.
Parameters#
- ts: str
TS (Time Series) vDataColumn used to order the data. The vDataColumn type must be date (date, datetime, timestamp…) or numerical.
- columns: SQLColumns, optional
List of the vDataColumns names. If empty, all numerical vDataColumns 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#
- obj
Plotting Object.
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 VerticaPy.
import verticapy as vp
Let’s also import numpy to create a dataset.
import numpy as np
Let’s generate a dataset using the following data.
data = vp.vDataFrame( { "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
vDataFrame.
range_plot()
: Range Plot.vDataColumn.
plot()
: Line Plot.