This is an archival dump of old wiki content --- see for current material.
Please see


MayaVi2 works with two kinds of "objects": modules and filters.

MayaVi Users Guide (v. 1.5) by P. Ramachandran defines them as follows:

You can run MayaVi2 using one of the following two ways:

Run MayaVi2 as is

Note: It is supposed here, in order to work, that your PATH variable contains the directory where MayaVi2 binary is installed (for instance, /usr/local/bin).

Begin to run MayaVi2:


MayaVi2 will be launched with a TVTK Scene which is blank.

The result should look like this (for issue concerning background/forground colors, see Cookbook/MayaVi/Tips):


Run MayaVi2 with some parameters: modules and filters available

In order to know what you can set as parameters on the command line, type

mayavi2 -h

This will list all the available options. Amongst all these options are:

Ok, you think you'll get rapidly tired to type all these long name modules and filters ? Don't worry, use your shell completion command !

For instance, for (t)csh shell, you can put this line in your configuration shell file:

complete mayavi2 c/-/"(3 d f m n M p q w x z)"/ n/-3/f:*.3ds/ n/-d/f:*.vt?/ n/-f/"(CellToPointData Delaunay2D Delaunay3D ExtractGrid ExtractUnstructuredGrid ExtractVectorNorm MaskPoints PointToCellData PolyDataNormals Threshold TransformData WarpScalar WarpVector)"/ n/-m/"(Axes ContourGridPlane CustomGridPlane Glyph GridPlane ImagePlaneWidget IsoSurface Outline OrientationAxes ScalarCutPlane SliceUnstructuredGrid Streamline StructuredGridOutline Surface Text Vectors VectorCutPlane Volume WarpVectorCutPlane)"/ n/-p/f:{*xyz.bin,*.xyz}/ n/-q/f:{*q.bin,*.q}/ n/-w/f:*.wrl/ n/-x/f:*.py/ n/-z/f:*.mv2/

Quite long to type the first time, but once typed, no more effort load the module or filter you want to use ! ;-)

Thus, typing (in MayaVi2's examples directory, see Cookbook/MayaVi/Installation):

mayavi2 -d data/heart.vtk -m Outline -m GridPlane -m GridPlane -m GridPlane -m ContourGridPlane -m ContourGridPlane -m IsoSurface -m ScalarCutPlane

you should get this:


Ok, this is not exactly the same as on the previous figure although exactly the same modules have been loaded.

The reason is that you did not set (and you can not, AFAIK) some modules properties, such as iso-value for IsoSurface module, normals to the GridPlane, etc.

Hopefully, you can set these parameters "by hand" using the GUI.

So now, let's play with this GUI ;-)

Moving around

So, you can see on these two figures the render window on the right (TVTK Scene) beside the modules tree on the left. Let's consider the first figure.

You can handle rendering scene with the mouse as usual using OpenGL:

Note: You can get a "predefined" angle of view (normal to x axis, y or z) clicking on the "View" item or on each small icons (first X: Ox axis points backwards you, second X: Ox axis points towards you, etc...)

On the left of the window, you can see which modules are loaded ("TVTK Scene" is the "root" of the scene, and "VTK file" is the data source, i.e. the heart.vtk file):

Note that no filter is used in these scenes.

Using each module/filter is very intuitive. Click on your module/filter in the tree and set some parameters with the mouse or enter some values at the keyboard, in the window at the bottom left of the GUI.

If you want to copy/paste/delete/cut a given module/filter, click on it with the right button. A small window popups, with a items list.

Note: You can get a larger window double-clicking on the choosen module/filter in the tree.

To load other modules or add filters, click on the "Visualize" item at the top of the window.

At last, you can also load another VTK data file, load/save the scene in a "MayaVi2" file (with extension .mv2), or convert it to the image format you want (PNG, JPEG...), clicking on the "File" item or on the appropriate icon (small floppy disk).

You can also get your scene in full-screen clicking on the small icon representing four red arrows in a little square. To disable full-screen mode, type 'e' or 'q'.

This is the simplest way to use MayaVi2. You are recalled here that you can also try mayavi2 -h to see what options and arguments you can add to the MayaVi2 command line.


SciPy: Cookbook/MayaVi/RunningMayavi2 (last edited 2015-10-24 17:48:23 by anonymous)