How to save a Brain object as a file

Hi,

I plotted source activation using the stc.plot() function as described here in: https://mne.tools/stable/auto_examples/visualization/plot_publication_figure.html
I want to save the plots in a certain directory as a file, with a certain name. The website used the 'screenshot()' function for the Brain object.
But I couldn't find any documentation on the screenshot() function describing its attributes. How do I specify the directory, or the figure size, or resolution?

Thanks,
Manorama Kadwani

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200622/76a8a361/attachment.html

External Email - Use Caution

The output of stc.plot() is a pysurfer.Brain object, so screenshot() is documented in the PySurfer docs, not the MNE-Python docs: https://pysurfer.github.io/generated/surfer.Brain.html#surfer.Brain.screenshot

Note that screenshot() does not save an image file, it "saves" the pixels as a NumPy array of RGB values, and assigns them to a variable. It does not create any files on disk. If you want to save it to disk, passing the variable to [matplotlib's plt.imsave()](https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.imsave.html) is probably easiest.

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

??? Original Message ???

External Email - Use Caution

And PySurfer uses Mayavi for the actual plotting. So even easier is to use:

from mayavi import mlab
mlab.savefig('my_brain.png')

https://docs.enthought.com/mayavi/mayavi/auto/mlab_figure.html#savefig

Thank you so much! Both of them were helpful.
-Manorama