问题
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()
but nothing happens. The zoom is the same as before; have I missed something?
回答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 in range(100):
cam.zoom(0.99)
mlab.draw()
mlab.show()
回答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.
来源:https://stackoverflow.com/questions/25783180/how-to-set-zoom-factor-in-mayavi