matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.58k stars 226 forks source link

ipympl does not work with JupyterNotebook, contradicts ReadMe #45

Closed thomasaarholt closed 6 years ago

thomasaarholt commented 6 years ago

On Windows (at least), I can only plot using ipympl with jupyter lab, not jupyter notebook.

The following code does not produce anything.

%matplotlib ipympl
import matplotlib.pyplot as plt
plt.plot([1,2,3])

Currently, the repo README lists installation instructions for Jupyter Notebook. Assuming this is just not a bug on my system (all my windows machines have this behaviour), I suggest that these be removed or commented out with an explanation.

In addition, it would be nice with a short "Usage" paragraph in the README with showing how one can (and should!) use %matplotlib ipympl instead of %matplotlib notebook in jupyter lab. I'm happy to amend the file and come up with a bit of text.

jenshnielsen commented 6 years ago

I just verified that it works in the Jupyer notebook on my mac. It seems most likely that there is a bug on windows

thomasaarholt commented 6 years ago

Okay, that's very interesting. I did a clean install of conda two days ago, and followed the installation instructions in the README. Not sure how to go about finding the bug.

thomasaarholt commented 6 years ago

I should clarify, it works fine for me in Jupyter Lab.

jenshnielsen commented 6 years ago

To be clear I have tested without conda, it could be a packaging related issue with the conda forge package too

thomasaarholt commented 6 years ago

Gosh, you're right. I just ran jupyter nbextension enable --py --sys-prefix ipympl, as according to the pip instructions, and it works great now!

I'll close this and create a correct issue.

jenshnielsen commented 6 years ago

In that case is there a bug in the conda pacakge or in the instructions in the readme. It seems to me like the extension is not activated correctly any more, AFAIK conda is supposed to do that step automatically

jenshnielsen commented 6 years ago

See that you opened that as #46, thanks

SylvainCorlay commented 6 years ago

@thomasaarholt @jenshnielsen I have just fixed the conda-forge recipe.

Also, 0.1.1 has been released. The main change in 0.1.1 is that there is no need to enable the extension at all even with pip if you use notebook >= 5.3.