vastorbit.VastFrame.contour¶
- VastFrame.contour(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'], func: Callable | str, nbins: int = 100, chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure¶
Draws the contour plot of the input function using two input VastColumns.
- Parameters:
columns (SQLColumns) – List of the VastColumns names. The list must have two elements.
func (function / str) – Function used to compute the contour score. It can also be a SQL expression.
nbins (int, optional) – Number of bins used to discretize the two input numerical VastColumns.
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 Contour Plot
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
For contour plots, we also need a function to apply:
def f(x, y): return x ** 2 - y + 1
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 examples of one type of contour plots:
Contour Plot
data.contour(columns = ["x", "y"], func = f)