jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.58k stars 4.85k forks source link

Does not show the first cell pylab plot #4137

Open kangwonlee opened 5 years ago

kangwonlee commented 5 years ago

Hi all

I tried to plot using a revision of my ipython notebook ask follows:

https://github.com/kangwonlee/nmisp-20-interp/commit/d0b4cbb4760edaf9737e33a6ef6c2227a226f168

If you view the file, I tried to import pylab and show() in the first cell. When I select the cell and press Shift+Enter, the plot does not show up at first (as In[1]) but at the second time (as In[2]), it does.

In the following revision, as I splitted the import pylab line as the first cell, the plot in the second cell shows up without much problem: https://github.com/kangwonlee/nmisp-20-interp/commit/1877621ffb693a612848cf664a2931589632d0a9

My jupyter version is 4.4.0.

$ jupyter --version
4.4.0

Let me know your opinion; is there a step that I missed? or do people usually try it differently?

Thanks for your attention.

KW

aknrdureegaesr commented 5 years ago

I have what I consider the same issue. From some engineering notebook, I have extracted an excerpt.

I open the notebook in the browser. I restart everything with "Kernel / Restart & clear output". I ask "Cell / Run all". Expected outcome: Graph is plotted. Outcome seen: Graph is not plotted.

I can then manually re-execute the cell. This causes the graph to be plotted.

I can also try to render from the command line with jupyter nbconvert bug.ipynb . Expected outcome: The HTML generated shows the graph. Outcome seen: It doesn't.

Here is my sample notebook that shows this behavior (wrapped in a ZIP archive, as github allows ZIP archives to be attached to issues):

bug.ipynb.zip

Moving the line import pandas as pd from the third cell to the first fixes the problem for me, too.