Matplotlib bottom cannot be <= top

I just came across this topic and am encountering a similar, if not identical problem, which arose only yesterday and which I could not solve using the above. Running Mac (OS Big Sur 11.3.1) with Python 3.9.2, IDLE 3.9.2, matplotlib 3.4.2, and mne 0.23.0.

Here’s my code:

import mne
raw=mne.io.read_raw_edf('file.edf', preload=True)
raw.plot()

Here’s my error message:

   File "/Users/fishbacp/Desktop/my_script.py", line 22, in <module> raw.plot()
    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site- 
   packages/mne/io/base.py", line 1531, in plot
    return plot_raw(self, events, duration, start, n_channels, bgcolor,
  File "<decorator-gen-161>", line 24, in plot_raw
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mne/viz/raw.py", line 342, in plot_raw
    fig = _browse_figure(**params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mne/viz/_figure.py", line 2278, in _browse_figure
    fig = _figure(inst=inst, toolbar=False, FigureClass=MNEBrowseFigure,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mne/viz/_figure.py", line 2266, in _figure
    fig = figure(FigureClass=FigureClass, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/pyplot.py", line 797, in figure
    manager = new_figure_manager(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/pyplot.py", line 316, in new_figure_manager
    return _backend_mod.new_figure_manager(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 3544, in new_figure_manager
    fig = fig_cls(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/mne/viz/_figure.py", line 401, in __init__
    self.subplotpars.update(left=left, bottom=bottom, top=top, right=right)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/figure.py", line 166, in update
    raise ValueError('bottom cannot be >= top')
ValueError: bottom cannot be >= top ```

I reinstalled matplotlib and mne and restarted my computer, but this doesn’t solve the problem. The data is loaded fine, as I can print out raw.info.

I entered print(mne.get_config_path()) as suggested above. It shows

/Users/fishbacp/.mne/mne-python.json

I don’t see this file anywhere in my system. I install mne with all my other packages in

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages

Thanks

Paul

the get_config_path() function doesn’t actually check whether a config file exists there, and indeed it may not exist unless you’ve called mne.set_config(...) at least once. Quite likely your problem is that it’s trying to plot a raw browser interface into a 640x480 window. I suggest running mne.set_config('MNE_BROWSE_RAW_SIZE', '16,9', setenv=False) and see if it works after that. Subsequently, the size of the browse window will be automatically stored in the config file, so matplotlib won’t attempt to open such a small window for raw data browsers any more.

Hello,

The Finder won’t show you this hidden folder by default. To navigate to the folder containing the file, in the Finder press Cmd–Shift–G and enter ~/.mne in the dialog box.

If you follow our official installation instructions, you should actually end up with a conda environment at a different location. Not saying that this is the cause of your issue, but we do observe that sometimes, problems arise if users install MNE-Python in a “non-standard” way (i.e., deviating from our installation instructions).

Thanks. Was able to find the file and delete it.