def _iterate_trans_views(function, **kwargs):
 from scipy.misc import imread
 import matplotlib.pyplot as plt
 import mayavi
 fig = function(**kwargs)
 assert isinstance(fig, mayavi.core.scene.Scene)
 views = [(90, 90), (0, 90), (0, (-90))]
 (fig2, axes) = plt.subplots(1, len(views))
 for (view, ax) in zip(views, axes):
  mayavi.mlab.view(view[0], view[1])
  tempdir = _TempDir()
  temp_fname = op.join(tempdir, 'test.png')
  if (fig.scene is not None):
   fig.scene.save_png(temp_fname)
   im = imread(temp_fname)
  else:
   im = np.zeros((2, 2, 3))
  ax.imshow(im)
  ax.axis('off')
 mayavi.mlab.close(fig)
 img = _fig_to_img(fig=fig2)
 return img

def _iterate_trans_views ( function , ** kwargs ) : from scipy . misc import imread import matplotlib . pyplot as plt import mayavi fig = function ( ** kwargs ) assert isinstance ( fig , mayavi . core . scene . Scene ) views = [ ( 90 , 90 ) , ( 0 , 90 ) , ( 0 , ( - 90 ) ) ] ( fig2 , axes ) = plt . subplots ( 1 , len ( views ) ) for ( view , ax ) in zip ( views , axes ) : mayavi . mlab . view ( view [ 0 ] , view [ 1 ] ) tempdir = _TempDir ( ) temp_fname = op . join ( tempdir , 'test.png' ) if ( fig . scene is not None ) : fig . scene . save_png ( temp_fname ) im = imread ( temp_fname ) else : im = np . zeros ( ( 2 , 2 , 3 ) ) ax . imshow ( im ) ax . axis ( 'off' ) mayavi . mlab . close ( fig ) img = _fig_to_img ( fig = fig2 ) return img
auxiliary function to iterate over views in trans fig .