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

**URL:** <https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization\
**Created:** [January 16, 2021, 6:46am UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499 "2021-01-16T06:46:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhdi.abolghasemi](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mhdi.abolghasemi](https://mne.discourse.group/u/mhdi.abolghasemi)\
**Post date:** [January 16, 2021, 6:46am UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/1 "2021-01-16T06:46:17Z")

</div>

- 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?

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [January 16, 2021, 7:38am UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/2 "2021-01-16T07:38:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mhdi.abolghasemi](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@mhdi.abolghasemi](https://mne.discourse.group/u/mhdi.abolghasemi)\
**Post date:** [January 16, 2021, 10:32am UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/4 "2021-01-16T10:32:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [January 16, 2021, 6:32pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/5 "2021-01-16T18:32:41Z")

</div>

@drammock, any idea what might cause this?

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [January 16, 2021, 8:11pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/6 "2021-01-16T20:11:00Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![charlotteprior](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/charlotteprior/32/268_2.png) [@charlotteprior](https://mne.discourse.group/u/charlotteprior)\
**Post date:** [March 8, 2021, 5:47pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/7 "2021-03-08T17:47:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [March 8, 2021, 6:09pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/8 "2021-03-08T18:09:08Z")

</div>

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:

```python
import mne

print(mne.get_config_path())

```

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

---

<div class="post-metadata">

**Author:** ![charlotteprior](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/charlotteprior/32/268_2.png) [@charlotteprior](https://mne.discourse.group/u/charlotteprior)\
**Post date:** [March 8, 2021, 6:31pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/9 "2021-03-08T18:31:08Z")

</div>

Thank you so much! It worked.

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [July 9, 2021, 7:35pm UTC](https://mne.discourse.group/t/matplotlib-qt-valueerror-bottom-cannot-be-top/2499/10 "2021-07-09T19:35:23Z")

</div>

A post was split to a new topic: [Matplotlib bottom cannot be \<= top](https://mne.discourse.group/t/matplotlib-bottom-cannot-be-top/3379)
