I want to save my plots as images but it saves in a windowed state and I would like to save the plots in fullscreen. Is it possible with qt or matplotlib as the backend?
- MNE version: 1.2.1
- operating system: Windows 10
Code:
import mne
import matplotlib
matplotlib.use('Qt5Agg')
print("Start")
fname = r"C:\Users\HP\Desktop\MD.mff"
raw = mne.io.read_raw_egi(fname, preload=False)
raw.crop(tmin=60.0, tmax=120.0).load_data()
print('crop')
raw.resample(250, npad="auto")
mne.viz.set_browser_backend('matplotlib', verbose=None)
fig = raw.plot(duration=60, scalings=40e-6, block=True, show_scrollbars=False, show_scalebars=False, n_channels=30)
fig.canvas.manager.full_screen_toggle()
fig.savefig('test_fig.png', bbox_inches='tight')
# fig.grab().save('screenshot_full.png')
print("saved")
fig.savefig()
works for matplolib figures and fig.grab().save()
works for plots generated using ‘qt’ as the backend. I am able to save the figures but not in fullscreen mode.
I actually used a for loop to save a plot from each epoch, so for 80 min of EEG data, I have 80 plots. I used fig.canvas.manager.full_screen_toggle()
but is there a better alternative method that works with either qt or matplotlib backends? The thing is that it opens an empty figure in fullscreeen and just keeps loading while opening the next plot. I don’t want it to display anything but just save the plot. Hope you guys can help with this, thanks in advance!