%matplotlib qt ,, ValueError: bottom cannot be >= top

  • MNE-Python version: 3.8
  • operating system: macOS

when I run this code “%matplotlib qt”, I could see a plot in 3D but after a while, in the running a code I get the ValueError: bottom cannot be >= top
How can I fix this?

Hello, which version auf MNE-Python are you using? You stated 3.8, but this is most likely your version of Python, not MNE-Python. This problem actually should not occur with the latest stable release, 0.22, anymore.

Hi thanks for reply
it is the latest version(0.22)
it was right first and i had a interactive plot but i dont know whats happening

@drammock, any idea what might cause this?

It’s a matplotlib error related to setting margins, probably in a call to subplots_adjust(). Without a reproducible example is hard to say any more than that. Can you provide a code sample that reproduces the error, and tell us more about what you were doing when it happened (resizing the window perhaps?)

1 Like

I am having the same error I am simply reading in EDF data and trying to plot it. Like :

data = mne.io.read_raw_edf(raw_path)
data.plot()

I am also using the %matplotlib qt, but I get the same error for the backend matplotlib.use(‘Qt5Agg’) and the TkAgg backend too. I think what happened is my mouse slipped and I resized the window so small, now I cant open anything.

I tried using things like:

plt = data.plot(duration = 30, start = 292, show = True)
plt.subplots_adjust(bottom=0)
plt.subplots_adjust(top=1)
plt.subplots_adjust(right=1)
plt.subplots_adjust(left=0)
plt

Nothing works. I hope you can help me @richard @drammock

Hello, a possible way to fix this is by resetting your MNE configuration. By default, MNE retains the size of your plotting window; if you delete the configuration file, the setting will be gone too, hopefully fixing your issue. You can find out where the config file is located by running:

import mne

print(mne.get_config_path())

If you then remove this file and restart Python / MNE-Python, all should be back to normal.

Thank you so much! It worked.

1 Like

A post was split to a new topic: Matplotlib bottom cannot be <= top