Increase figure size of raw.plot

Hi,

I have been trying to find here and others how to increase the size of figure that I plot from raw, yet I could not find it. In general, how can I incrase the size of plot figure ? In this case, I attached the figure size that I plot from raw data. That would be great if you could help me with it.


eeg_picks = mne.pick_types(raw1.info, meg=False, eeg=True)
ax1 = plt.figure(figsize=(12,5)) # This seems does not work and no idea where to put it in plot function below
raw1.plot(events=eog_events, order=eeg_picks, scalings=150e-6);

image

  • MNE-Python version: 0.20.7
  • operating system: Ubuntu

Which editor are you using? It seems like it shows all figures inline, but there should be a setting which creates figures in separate windows (which you can resize).

I am using atom IDE. It cannot be scrolled as well.
What is the parameter to increase the size ? Any parameter?

The problem is that the figure is not displayed in a separate window it seems. You need to set the matplotlib backend to e.g. qt5 and not inline. How do you run the script? I don’t use Atom myself so I cannot help you find the relevant setting.

@cbrnr

I think it is because I am running it in the headless server. Kindly see the error below after I changed the backend with qt5 as you suggested with the code below. The forum has raised this kind of issue before. I will try to run in local then. However, if you have an experience of running codes in server and are able to produce GUI, please let me know. Thanks.

import matplotlib
matplotlib.use('Qt5Agg')
# When the following line is executed, then the error was raised
import matplotlib.pyplot as plt  

1 Like

when running in a headless server, you can’t use Qt5Agg but probably could use Agg. You won’t get any GUI but you will get figure objects created, which you can save as image files, then download the image files from your server to your local machine to view them. Another approach to plotting on headless (linux) servers is xvfb.

Plotting on headless servers is a pretty general issue, not specific to MNE-Python, so I recommend asking follow-up questions in a more general forum (maybe the matplotlib forum)

1 Like

Thanks for the suggestion. I will try to install that package