[Mne_analysis] Inhibit figure plot

Dan McCloy dan at mccloy.info
Mon Feb 8 17:11:35 EST 2021
Search archives:

        External Email - Use Caution        

Bruno,
Can you report your MNE-Python version info? For me the following works correctly (no plot windows are opened):

import mne
import matplotlib.pyplot as plt
# do whatever needed to create your epochs, and then:
for ch in epochs.ch_names:
fig = epochs.plot_image(picks=ch, show=False)[0]
fig.savefig(f'epoch_image_{ch}.png')
plt.close(fig)

-- dan
Daniel McCloy
https://secure-web.cisco.com/1fXQ6OxNSULyPm1L2l7FDpXOK9QJx_qnmalSfkpUy-b09M0r6-zmBvbLVUL44G3sncGTTOfsNY31t4xUZnaQ8CGPF6i51g4P8sgo2oWO6qphl2xmhuf0nz9swQUkvr3wqm29pS4attzCmgpP5_0pEe9KuMMZaNtvs2MbcfygmHcIbk_eEQYH774J-SQkA9dfch5QR6-ylK_vIjfwiCl-PibyJEskvzruxUtTTucqjyO5spn4mc7YSk85bdYfdBwax3N6uDHa3ZXxHCvtD--wpYg/https%3A%2F%2Fdan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, February 3, 2021 6:05 PM, Bruno Mansur <brunommansur at gmail.com> wrote:

> External Email - Use Caution
>
> Dear MNE list members,
>
> I have a script that generates several plots and it slows down the code execution speed:
>
> for ch in evoked_OGT.ch_names:
> fig = epochs_OGT.plot_image(picks=ch, title=ch+' '+'OGT', show=False)
> plt.savefig('/home//Evoked_OGT_%s.png'%(ch), show=False)
>
> Although I set 'show=false', the function 'plot_image' keeps opening new windows with figure plots. The output is not showing up in the console, but really opening new windows that I have to be closed every time I run the code.
>
> I'm using QT5 as a graphics backend option.
>
> Is there a way to stop mne functions from opening new windows?
>
> I would appreciate any help,
>
> Best regards,
>
> Bruno Mansur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20210208/d668a4ff/attachment.html 


More information about the Mne_analysis mailing list