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
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
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¶
Plots glyphs (like points) at the position of the supplied data, described by
Plots line between the supplied data, described by
Vertical scale of
contour_surf() can be used as 3D
representation of 2D data. By default the z-axis is supposed to
be in the same units as the x and y axis, but it can be
auto-scaled to give a 2/3 aspect ratio. This behavior can be
controlled by specifying the “warp_scale=’auto’”.
From data points to surfaces.
Knowing the positions of data points is not enough to define a
surface, connectivity information is also required. With the
mesh(), this connectivity
information is implicitly extracted from the shape of the input
arrays: neighboring data points in the 2D input arrays are
connected, and the data lies on a grid. With the function
triangular_mesh(), connectivity is explicitly specified.
Quite often, the connectivity is not regular, but is not known in
advance either. The data points lie on a surface, and we want to
plot the surface implicitly defined. The delaunay2d filter does
the required nearest-neighbor matching, and interpolation, as
shown in the (Surface from irregular data example).
Structured or unstructured data
flow() require ordered data (to
be able to interpolate between the points), whereas
works with any set of points. The required structure is detailed
in the functions’ documentation.