MATLAB has a hold
function (if I remember correctly, it's been a while) to plot several things on the same "graph"/window. Is there anyway to do this in Mayavi? I'd like to visualize several realizations of a calculation, and have them all on the same graph. But I haven't been able to figure it out from reading the documentation.
If you are using the mlab module of mayavi, it will hold by default. Example:
In [1]: from mayavi import mlab
In [2]: import numpy as np
In [3]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[3]: <mayavi.modules.surface.Surface at 0x2a4eade0>
In [4]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[4]: <mayavi.modules.surface.Surface at 0x28218ab0>
In [5]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[5]: <mayavi.modules.surface.Surface at 0x2a51db40>
In [6]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[6]: <mayavi.modules.surface.Surface at 0x2a840bd0>
The three plots will be in the same figure.
If you create a new figure, the new ones will be added to this new figure. You can also directly assign a new plot to a given figure with the figure
keyword argument.