vispy.visuals.surface_plot module#

class vispy.visuals.surface_plot.SurfacePlotVisual(x=None, y=None, z=None, colors=None, **kwargs)#

Bases: MeshVisual

Displays a surface plot on a regular x,y grid

Parameters:
xndarray | None

1D/2D array of values specifying the x positions of vertices in the grid. In case 1D array given as input, the values will be replicated to fill the 2D array of size(z). If None, values will be assumed to be integers.

yndarray | None

1D/2D array of values specifying the y positions of vertices in the grid. In case 1D array given as input, the values will be replicated to fill the 2D array of size(z). If None, values will be assumed to be integers.

zndarray

2D array of height values for each grid vertex.

colorsndarray

(width, height, 4) array of vertex colors.

Notes

All arguments are optional.

Note that if vertex positions are updated, the normal vectors for each triangle must be recomputed. This is somewhat expensive if the surface was initialized with smooth=False and very expensive if smooth=True. For faster performance, initialize with compute_normals=False and use per-vertex colors or a material that does not require normals.

set_data(x=None, y=None, z=None, colors=None)#

Update the data in this surface plot.

Parameters:
xndarray | None

1D/2D array of values specifying the x positions of vertices in the grid. In case 1D array given as input, the values will be replicated to fill the 2D array of size(z). If None, values will be assumed to be integers.

yndarray | None

1D/2D array of values specifying the x positions of vertices in the grid. In case 1D array given as input, the values will be replicated to fill the 2D array of size(z). If None, values will be assumed to be integers.

zndarray

2D array of height values for each grid vertex.

colorsndarray

(width, height, 4) array of vertex colors.