# Why does using a different IDE affect my raw.plot()?

**URL:** <https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization\
**Created:** [March 1, 2021, 9:37pm UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770 "2021-03-01T21:37:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulF](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@PaulF](https://mne.discourse.group/u/PaulF)\
**Post date:** [March 1, 2021, 9:37pm UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770/1 "2021-03-01T21:37:29Z")

</div>

I’m using MNE .22 with Python 3.9.2 on a Mac running OS 10.15.4. I switched from Matlab to Python a couple years ago and have been using Idle as my IDE up to now, but have to decided to transition to PyCharm. I’ve discovered something peculiar when creating a plot of my raw data:

```python
import mne as mn
import matplotlib.pyplot as plt
plt.switch_backend('TkAgg')
plt.ion()
raw = mn.io.read_raw_edf("my_file.edf", preload=True)
raw.plot()

```

It couldn’t be any simpler. 😀This works fine when I run it from the shell in Idle and I’m able to scroll through my data. In PyCharm, I get the data plot, but it closes immediately. No chance to scroll, remove bad channels, or annotate.

Python 3.9 (ProjectName) -/PyCharmProjects/ProjectName/venv/bin/python

is the listed interpreter, although I understand little about venv and virtual environments.

I should mention that many plot tools I’ve created using Matplotlib, which utilize MNE for loading data, extracting raw.info, etc. work fine. when I run them from PyCharm.

I apologize if this question isn’t really appropriate for this forum. Also, if any MNE users have a preferred IDE, I’d enjoy hearing suggestions.

---

<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 2, 2021, 6:31am UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770/2 "2021-03-02T06:31:56Z")

</div>

Hello,

The Python interpreter closes immediately after opening the plot window, because the end of your script is reached. You have two ways to work around this:

- Ensure execution is halted after plotting by passing `block=True`, i.e. `raw.plot(block=True)`
- Or edit your PyCharm run configuration such that your script is run in interactive mode (which might be something you want when working with data interactively anyway!) by ticking the “Run with Python Console” box. See [Create and edit run/debug configurations—PyCharm](https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html) for more info on run configurations in PyCharm

---

<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:** [March 2, 2021, 2:43pm UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770/3 "2021-03-02T14:43:28Z")

</div>

To answer your question about IDEs, we have a brief discussion here that tries not to be too opinionated: [Installing MNE-Python — MNE 0.23.dev0 documentation](https://mne.tools/dev/install/mne_python.html#python-ides)

Personally I started out on Spyder, then switched to Atom after a couple years, and a couple years later switched to VSCode. Several other MNE-Python devs also use VSCode, some use PyCharm, at least one was using emacs (as of 2019 at least). A lot of the folks in my research institute (MNE-Python users, not devs) prefer Spyder (which is much better nowadays than it was when I stopped using it).

---

<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:** [June 17, 2021, 7:48pm UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770/4 "2021-06-17T19:48:33Z")

</div>

Split this topic on June 17, 2021, 7:48pm UTC

4 posts were split to a new topic: [Problems running mne.viz.plot\_alignment() from within Spyder](https://mne.discourse.group/t/problems-running-mne-viz-plot-alignment-from-within-spyder/3274)

---

<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:** [June 21, 2021, 4:14pm UTC](https://mne.discourse.group/t/why-does-using-a-different-ide-affect-my-raw-plot/2770/5 "2021-06-21T16:14:12Z")

</div>

Split this topic on June 21, 2021, 4:14pm UTC

A post was split to a new topic: [MNE objects not shown in Spyder variable explorer](https://mne.discourse.group/t/mne-objects-not-shown-in-spyder-variable-explorer/3296)
