differt.plotting.draw_surface

Contents

differt.plotting.draw_surface#

draw_surface(x=None, y=None, *, z, colors=None, **kwargs)[source]#

Plot a 3D surface.

Parameters:
Return type:

Any

Returns:

The resulting plot output.

Warning

Matplotlib requires colors to be RGB or RGBA values. VisPy currently does not support colors.

Examples

The following example shows how to plot a 3-D surface, without and with custom coloring.

>>> from differt.plotting import draw_surface
>>>
>>> u = np.linspace(0, 2 * np.pi, 100)
>>> v = np.linspace(0, np.pi, 100)
>>> x = np.outer(np.cos(u), np.sin(v))
>>> y = np.outer(np.sin(u), np.sin(v))
>>> z = np.outer(np.cos(u), np.cos(v))
>>> fig1 = draw_surface(x, y, z=z, backend="plotly")
>>> fig1
>>>
>>> fig2 = draw_surface(
...     x, y, z=z, colors=x * x + y * y + z * z, backend="plotly"
... )
>>> fig2