Loading...

verticapy.vDataFrame.hexbin#

vDataFrame.hexbin(columns: str | list[str], method: Literal['density', 'count', 'avg', 'min', 'max', 'sum'] | str = 'count', of: str | None = None, bbox: list | None = None, img: str | None = None, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure#

Draws the Hexbin of the input vDataColumns based on an aggregation.

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).

of: str, optional

The vDataColumn used to compute the aggregation.

bbox: list, optional

List of 4 elements to delimit the boundaries of the final Plot. It must be similar the following list: [xmin, xmax, ymin, ymax]

img: str, optional

Path to the image used as a background.

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 hexbin plots:

  • Hexbin

data.hexbin(columns = ["x", "y"])
Out[5]: <Axes: xlabel='x', ylabel='y'>
../_images/core_vdataframe_plotting_vdf_hexbin_1.png

See also

vDataFrame.heatmap() : Heatmap.
vDataFrame.contour() : Contour Plot.