Skip to content Skip to sidebar Skip to footer

How To Set Zoom Factor In Mayavi

I am trying to set the zoom factor in Mayavi2, for example: from mayavi import mlab mlab.test_plot3d() mlab.show() f = mlab.gcf() cam = f.scene.camera cam.zoom(0.1) mlab.draw() b

Solution 1:

It seems that you have just inverted 2 lines. mlab.show() and mlab.draw() !

Try this:

from mayavi import mlab

currfig = mlab.test_plot3d()
mlab.draw()

cam = currfig.scene.camera
for ii inrange(100):
  cam.zoom(0.99)
  mlab.draw()

mlab.show()

Solution 2:

You can use mlab.view(distance=200)

I don't know of a useful scale to tell you what exactly that distance number means though, I use some experimenting to determine good values.

Post a Comment for "How To Set Zoom Factor In Mayavi"