3D Plotting functions for numpy arrays

Visualization can be created in mlab by a set of functions operating on numpy arrays.

The mlab plotting functions take numpy arrays as input, describing the x, y, and z coordinates of the data. They build full-blown visualizations: they create the data source, filters if necessary, and add the visualization modules. Their behavior, and thus the visualization created, can be fine-tuned through keyword arguments, similarly to pylab. In addition, they all return the visualization module created, thus visualization can also be modified by changing the attributes of this module.

Note

In this section, we only list the different functions. Each function is described in detail in the MLab reference, at the end of the user guide, with figures and examples. Please follow the links.

0D and 1D data

points3d

points3d()
Plots glyphs (like points) at the position of the supplied data, described by x, y, z numpy arrays of the same shape.

plot3d

plot3d()
Plots line between the supplied data, described by x, y, z 1D numpy arrays of the same length.

2D data

imshow

imshow()
View a 2D array as an image.

surf

surf()
View a 2D array as a carpet plot, with the z axis representation through elevation the value of the array points.

contour_surf

contour_surf()
View a 2D array as line contours, elevated according to the value of the array points.

mesh

mesh()
Plot a surface described by three 2D arrays, x, y, z giving the coordinates of the data points as a grid.
Unlike surf(), the surface is defined by its x, y and z coordinates with no privileged direction. More complex surfaces can be created.

barchart

barchart()
Plot an array s, or a set of points with explicit coordinates arrays, x, y and z, as a bar chart, eg for histograms.
This function is very versatile and will accept 2D or 3D arrays, but also clouds of points, to position the bars.

triangular_mesh

triangular_mesh()
Plot a triangular mesh, fully specified by x, y and z coordinates of its vertices, and the (n, 3) array of the indices of the triangles.

3D data

contour3d

contour3d()
Plot iso-surfaces of volumetric data defined as a 3D array.

quiver3d

quiver3d()
Plot arrows to represent vectors at data points. The x, y, z position are specified by numpy arrays, as well as the u, v, w components of the vectors.

flow

flow()
Plot a trajectory of particles along a vector field described by three 3D arrays giving the u, v, w components on a grid.

slice

volume_slice()
Plots an interactive image plane sliced through volumetric data.

Note

Many richer visualizations can be created by assembling data sources filters and modules. See the Assembling pipelines with mlab and the Case studies of some visualizations sections.