voyagerpy.plotting.plot.contour_plot#

voyagerpy.plotting.plot.contour_plot(ax: Axes, x: str | ndarray | Series, y: str | ndarray | Series, data: Any | None = None, shape: Tuple[int, int] = (100, 100), levels: int = 7, colors: str | Sequence[str] = 'cyan', linewidths: float | None = 1, origin: str | None = None) Axes#

Create a contour plot.

Creates contours from the data in x and y. If data is not None, then x and y can be column names in data. Otherwise, x and y are assumed to be numpy arrays or pandas Series.

This function is a wrapper around matplotlib.axes.Axes.contour(). For more information on the parameters, see the documentation.

Parameters:
  • ax (Axes) – The axes to plot on.

  • x (Union[str, np.ndarray, Series]) – The data to plot on the x-axis. If str, then x is assumed to be a column name in data.

  • y (Union[str, np.ndarray, Series]) – The data to plot on the y-axis. If str, then y is assumed to be a column name in data.

  • data (Any, optional) – Must be a mappable with the keys supplied by x and y if they are of type str, by default None

  • shape (Tuple[int, int], optional) – The shape of the grid the contours are computed for, by default (100, 100). The larger the shape, the finer the contours.

  • levels (int, optional) – The number of levels to use for the contours, by default 7

  • colors (Union[str, Sequence[str]], optional) – The color(s) to use for the contours, by default “cyan”. If a sequence, then the length must be equal to levels.

  • linewidths (Optional[float], optional) – The width of the contour lines, by default 1

  • origin (Optional[str], optional) – The origin of the coordinate system, by default None.

Returns:

The axes with the contour plot.

Return type:

Axes

Raises:

ValueError – If x or y are of type str and data is None.