Skip to main content
`Ctrl`+`K`

# vispy.visuals.gridmesh module

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

  Bases: `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:
    xs ndarray

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

    ys ndarray

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

    zs ndarray

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

    colors ndarray | 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.

    shading str | 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:
      xs ndarray | None

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

      ys ndarray | None

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

      zs ndarray | None

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

      colors ndarray | 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.