differt.plotting.draw_contour

Contents

differt.plotting.draw_contour#

draw_contour(data, x=None, y=None, z0=0.0, levels=None, fill=False, **kwargs)[source]#

Plot a 2D contour on a 3D canvas, at a fixed z-coordinate.

Parameters:
Return type:

Any

Returns:

The resulting plot output.

Warning

VisPy does not support filling the contour. Plotly does not support 3D contours, and will draw the contour on a 2D figure instead.

Examples

The following example shows how to plot a 2-D contour, without and with axis scaling, and filling.

>>> from differt.plotting import draw_contour
>>>
>>> x = np.linspace(-1.0, +1.0, 10)
>>> y = np.linspace(-4.0, +4.0, 20)
>>> X, Y = np.meshgrid(x, y)
>>> Z = np.cos(X) * np.sin(Y)
>>> fig1 = draw_contour(Z, backend="plotly")
>>> fig1
>>>
>>> fig2 = draw_contour(Z, x=x, y=y, fill=True, backend="plotly")
>>> fig2