sooon - 1 year ago 132

Python Question

I just started to use

`Jupiter Notebook`

`Python`

`matplotlib`

`import numpy as np`

import matplotlib.pyplot as plt

plt.plot([1,2,3,4])

plt.ylabel('some numbers')

plt.show()

The kernel just keep running and nothing happen. How to resolve this? Is there an dependency issue? My newly installed

`matplotlib`

`python`

`numpy`

Answer Source

To Visualize the plots created by the matplotlib in **Jupiter Notebook or ipython notebook** you have add one extra line at the beginning.

```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```

If your matplotlib **version is above 1.4, and you are using IPython 3.x** you have to use the below code.

```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib notebook
```