Search code examples
pythonmayavimayavi.mlab

How can I quickly find the syntax for manipulating my mlab/mayavi plot?


I have plotted something with Mayavi/mlab, and I can't remember what the proper syntax is

  • to set the camera position,
  • change the view angle, or
  • turn parallel projection on/off
  • etc

Is there a faster way to get this syntax than wading through the mlab documentation, or asking another question on Stack Overflow?


Solution

  • Mlab can auto-generate code for anything that can be changed via the GUI interface - this is an extremely efficient way to get the syntax you need.

    From the figure window, click the Mayavi icon in the upper left corner, then click the red button in the "Mayavi Pipeline" window. This will open a window that prints all the commands corresponding to changes you make with the GUI, which can be copied into your script. This is much faster than googling/asking Stack Overflow.