Loading...

vastorbit.VastFrame.hexbin

VastFrame.hexbin(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'], method: Literal[None, '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 | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure

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

Parameters:
  • columns (SQLColumns) – List of the VastColumns 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 VastColumns of.

    • min:

      Minimum of the VastColumns of.

    • max:

      Maximum of the VastColumns of.

    • sum:

      Sum of the VastColumns of.

    • q%:

      q Quantile of the VastColumns of (ex: 50% to get the median).

    • None:

      No Aggregations.

  • of (str, optional) – The VastColumn 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:

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 Chart Gallery

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 N to fix the size:

N = 30

Let’s generate a dataset using the following data.

data = vo.VastFrame(
    {
        "x": np.random.normal(5, 1, N),
        "y": np.random.normal(8, 1.5, N),
    }
)

Below is an example of one type of hexbin plots:

  • Hexbin

@suppress
vo.set_option("plotting_lib", "matplotlib")

data.hexbin(columns = ["x", "y"])

See also

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