fastplotlib.SurfaceGraphic#

class SurfaceGraphic(data, mode='phong', colors='w', mapcoords=None, cmap=None, clim=None, **kwargs)[source]#

Create a Surface mesh Graphic

Parameters:
  • data (array-like) – A height-map (an image where the values indicate height, i.e. z values). Can also be a [m, n, 3] to explicitly specify the x and y values in addition to the z values. [m, n, 3] is a dstack of (x, y, z) values that form a grid on the xy plane.

  • mode (one of "basic", "phong", "slice", default "phong") –

  • colors (str, array, or iterable, default "w") – A uniform color, or the per-position colors.

  • mapcoords (array-like) – The per-position coordinates to which to apply the colormap (a.k.a. texcoords). These can e.g. be some domain-specific value (mapped to [0..1] using clim). If not given, they will be the depth (z-coordinate) of the surface.

  • cmap (str, optional) – Apply a colormap to the mesh, this overrides any argument passed to “colors”. For supported colormaps see the cmap library catalogue: https://cmap-docs.readthedocs.io/en/stable/catalog/ Both 1D and 2D colormaps are supported, though the mapcoords has to match the dimensionality.

  • clim (tuple[float, float]) – The colormap limits. If the mapcoords has values between e.g. 5 and 90, you want to set the clim to e.g. (5, 90) or (0, 100) to determine how the values map onto the colormap.

  • **kwargs – passed to Graphic

Examples#

Image surface

Image surface

Earth sphere animation

Earth sphere animation

Ellipsoid surface

Ellipsoid surface

Gaussian kernel as a surface

Gaussian kernel as a surface

Simple surface

Simple surface

Surface animation

Surface animation

Sphere ripple animation

Sphere ripple animation