Mayavi may be thought of as a Python layer atop VTK, making common 3-D data plotting tasks easy.
Mayavi is installed via
VTK, Traits, et al have
.whl binary wheel
wheels, which avoid the previously painful build process.
Because of the large number of prereq packages for Mayavi, we strongly urge installing Mayavi in a seperate virtualenv or Conda environment.
conda install mayavi
Mayavi makes high quality manipulable volume plots.
Create a file
scalar_field.py with the content
from mayavi import mlab import numpy as np x, y, z = np.mgrid[-10:10:20j, -10:10:20j, -10:10:20j] s = np.sin(x*y*z)/(x*y*z) scf = mlab.pipeline.scalar_field(x,y,z,s) mlab.pipeline.volume(scf) mlab.show()
Test programs for Mayavi. Mayavi should not error with
ImportError: Could not import backend for traits
There may be spurious errors during install such as:
ModuleNotFoundError: No module named ‘vtk’
but Mayavi usually works anyway.