Interactive matplotlib usage with IPython in PyCharm Follow
Hello,
when I use Pycharm, I usually execute my scripts in the `Terminal` window at the bottom with a command like this `ipython -i myscript.py`, which executes my program and also saves the variables for me, so I can quickly inspect and modify them, which is incredible useful in early stages of development.
The only problem is, that if I want to modify graphs that I made with `matplotlib`, that doesn't seem to be possible. I can generate the desired object, e.g. `ax.scatter([1,2,3],[1,2,3])` which print this output: `<matplotlib.collections.PathCollection at 0x11571ffb320>`. However, if I call `plt.show()` afterwards, nothing happens and the window which usually pops up doesn't appear.
If somebody could point out what I am doing wrong, or how I could accomplish this "interactive" plotting, I would be incredibly thankful!
Cheers!
Please sign in to leave a comment.
Hi, why not use Python console instead? https://www.jetbrains.com/help/pycharm/interactive-console.html
You can run your python file in a console by enabling the checkbox in run/debug configuration:
Thanks for answering me. I also saw this option, but this didn't change the behavoir of plt.show().
I still was not able to get the new plot to show.
Understood. So the main issue is that plt.show() doesn't render any plots? If so, please try running your code from the terminal outside of IDE - do you get the same issue?
Exactly. Only the "inital" plot is shown. When I change parameters and call plt.show() again, nothing happens.
Interestingly, if I run it from the terminal outside of the IDE, plt.show() works as intended. I.e. after running ipython -i myscripy.py i can create new artists in the consol and then call plt.show() which renders the new plot.
Thanks,
Could you report the issue to https://youtrack.jetbrains.com/issues/py with the code sample and exact steps to reproduce?