This section is only a reference describing the function, please see the chapter on mlab: Python scripting for 3D plotting for an introduction to mlab and how to interact with and assemble the functions of mlab.

Please see the section on Running mlab scripts for instructions on running the examples.


add_dataset, name='', **kwargs)

Add a dataset object to the Mayavi pipeline.



a tvtk/vtk dataset/tvtk/VTK Algorithm, or a Mayavi source. The dataset added to the Mayavi pipeline


a figure identifier number or string, None or False, optional.

If no figure keyword argument is given, the data is added to the current figure (a new figure if created if necessary).

If a figure keyword argument is given, it should either the name the number of the figure the dataset should be added to, or None, in which case the data is not added to the pipeline.

If figure is False, a null engine is created. This null engine does not create figures, and is mainly usefull for tensting, or using the VTK algorithms without visualization.


The corresponding Mayavi source is returned.


Add a module-manager, to control colors and legend bars to the given object.

get_vtk_src, stop_at_filter=True)

Goes up the Mayavi pipeline to find the data sources of a given object.



any Mayavi visualization object


optional boolean flag: if True, the first object exposing data found going up the pipeline is returned. If False, only the source itself is returned.



List of vtk data sources (vtk data sources, and not Mayavi source objects).


This function traverses the Mayavi pipeline. Thus the input object ‘mayavi_object’ should already be added to the pipeline.

set_extent, extents)

Attempts to set the physical extents of the given module.

The extents are given as (xmin, xmax, ymin, ymax, zmin, zmax). This does not work on an image plane widget, as this module does not have an actor.

Once you use this function on a module, be aware that other modules applied on the same data source will not share the same scale. Thus for instance an outline module will not respect the outline of the actors whose extent you modified. You should pass in the same “extents” parameter for this to work.You can have a look at the example for a heavy use of this functionality.


This function does not work on some specific modules, such as Outline, Axes, or ImagePlaneWidget. For Outline and Axes, use the extent keyword argument of mlab.pipeline.outline and mlab.pipeline.axes.


Generator to traverse a tree accessing the nodes’ children attribute.


Here is a simple example printing the names of all the objects in the pipeline:

for obj in mlab.pipeline.traverse(mlab.gcf()):