code: def m2screenshot(mayavi_fig=None, mpl_axes=None, autocrop=True):
      """Capture a screeshot of the Mayavi figure and display it in the
      matplotlib axes.
      """
      import matplotlib.pyplot as plt
  
      # Late import to avoid triggering wx imports before needed.
      try:
          from mayavi import mlab
      except ImportError:
          # Try out old install of Mayavi, with namespace packages
          from enthought.mayavi import mlab
  
      if mayavi_fig is None:
          mayavi_fig = mlab.gcf()
      else:
          mlab.figure(mayavi_fig)
      if mpl_axes is not None:
          plt.axes(mpl_axes)
  
      # XXX: This is a hack to force Mayavi to render.
      # It should not be needed if a GUI loop is running,
      # but just to be safe...
      # https://github.com/enthought/mayavi/issues/702
      mayavi_fig.scene._lift()
  
      image3d = mlab.screenshot(figure=mayavi_fig)
      if autocrop:
          bg_color = mayavi_fig.scene.background
          image3d = autocrop_img(image3d, bg_color)
      plt.imshow(image3d)
      plt.axis("off")
  
file_path: nipy/nipy/labs/viz_tools/maps_3d.py
imports: import os
  import tempfile
  import numpy
  from scipy import stats
  from .anat_cache import _AnatCache, mni_sform, mni_sform_inv
  from .coord_tools import coord_transform
label_desc: Use image node_id 3 for calling a global function with example usage: m2screenshot(mayavi_fig, mpl_axes, autocrop) without return types