2
votes

I have been looking for a solution to the following problem for the last couple of weeks:

Interactive matplotlib plotting is already a thing, but does not work properly in Pycharm, when used within a jupyter notebook.

The %matplotlib notebook does not work (throws no error, but I get instead of a plot. If I plot normally (also with or without plt.show()) I just get a png and cannot interact in any way (even if, e.g., sliders are visible).

I couldn't find any answers elsewhere to this exact problem. It might be working in the browser version of jupyter, but I would like to stick to using PyCharm.

Pycharm v 2017.3 Community Edition

Thanks a lot in advance!

1
Do you have a problem with jupyter or with PyCharm? What exactly is the problem? - ImportanceOfBeingErnest
problem is with pycharm. If I try to reproduce the behavior using the web version of jupyter, it works. It just does not work when running within pycharm (the notebook itself) - Kris Jobs

1 Answers

2
votes

You can try:

import matplotlib 
matplotlib.use('Qt5Agg') 
import Matplotlib.pyplot as plt

Instead of importing only the peplos. It's a trick I found on forum of Jetbrains https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000736584-SciView-in-PyCharm-2017-3-reduces-functionality-of-Matplotlib It works for me. With this, you skip actually the Sciview and plot in a normal matplotlib window