vispy.visuals.gridmesh module

class vispy.visuals.gridmesh.GridMeshVisual(xs, ys, zs, colors=None, shading='smooth', **kwargs)

Bases: vispy.visuals.mesh.MeshVisual

Displays a mesh in a Cartesian grid about x,y,z coordinates.

This makes it simple to generate a mesh from e.g. the output of numpy.meshgrid.

All arguments are optional, though they can be changed individually later with the set_data method.

Parameters
xsndarray

A 2d array of x coordinates for the vertices of the mesh. Must have the same dimensions as ys and zs.

ysndarray

A 2d array of y coordinates for the vertices of the mesh. Must have the same dimensions as xs and zs.

zsndarray

A 2d array of z coordinates for the vertices of the mesh. Must have the same dimensions as xs and ys.

colorsndarray | None

The colors of the points of the mesh. Should be either a (width, height, 4) array of rgba colors at each grid point or a (width, height, 3) array of rgb colors at each grid point. Defaults to None, in which case the default color of a MeshVisual is used.

shadingstr | None

Same as for the MeshVisual class. Defaults to ‘smooth’.

**kwargs :

Other arguments are passed directly to MeshVisual.

set_data(xs=None, ys=None, zs=None, colors=None)

Update the mesh data.

Parameters
xsndarray | None

A 2d array of x coordinates for the vertices of the mesh.

ysndarray | None

A 2d array of y coordinates for the vertices of the mesh.

zsndarray | None

A 2d array of z coordinates for the vertices of the mesh.

colorsndarray | None

The color at each point of the mesh. Must have shape (width, height, 4) or (width, height, 3) for rgba or rgb color definitions respectively.