verticapy.vDataFrame.heatmap#
- vDataFrame.heatmap(columns: str | list[str], method: Literal['density', 'count', 'avg', 'min', 'max', 'sum'] | str = 'count', of: str | None = None, h: tuple = (None, None), chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure #
Draws the Heatmap of the two input vDataColumns.
Parameters#
- columns: SQLColumns
List of the vDataColumns names. The list must have two elements.
- method: str, optional
The method used to aggregate the data.
- count:
Number of elements.
- density:
Percentage of the distribution.
- mean:
Average of the
vDataColumns
of
.
- min:
Minimum of the
vDataColumns
of
.
- max:
Maximum of the
vDataColumns
of
.
- sum:
Sum of the
vDataColumns
of
.
- q%:
q Quantile of the
vDataColumns
of
(ex: 50% to get the median).
It can also be a cutomized aggregation (ex: AVG(column1) + 5).
- of: str, optional
The vDataColumn used to compute the aggregation.
- h: tuple, optional
Interval width of the vDataColumns 1 and 2 bars. Optimized h will be computed if the parameter is empty or invalid.
- 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 Chart Gallery
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( { "x": np.random.normal(5, 1, N), "y": np.random.normal(8, 1.5, N), } )
Below is an examples of one type of heatmap plots:
Heatmap
data.heatmap(columns = ["x", "y"])