Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib plots not showing on Jupyter Notebook when I 'run all'

The plots are not displayed inline in notebooks when using matplotlib

The plots appear completely blank. Any ideas?

seen here

like image 906
WilliamGates Avatar asked Nov 27 '17 09:11

WilliamGates


People also ask

Why is my plot not showing up in Python?

It means if we are not using the show() function, it wouldn't show any plot. When we use the show() function in the non-interactive mode. That means when we write the code in the file it will show all the figures or plots and blocks until the plots have been closed.

How do you display plots in Jupyter notebook?

Jupyter Notebook - Big Data Visualization Tool IPython kernel of Jupyter notebook is able to display plots of code in input cells. It works seamlessly with matplotlib library. The inline option with the %matplotlib magic function renders the plot out cell even if show() function of plot object is not called.


2 Answers

Came across the same issue on calling "Restart & Run all". Following this

%matplotlib notebook showing a blank histogram

I could resolve the issue adding

%matplotlib inline

at the beginning of the cell. Also note that you can prevent string output by adding ; to the end of a line.

like image 188
dgruending Avatar answered Oct 07 '22 01:10

dgruending


I faced a similar issue with my Chrome Browser, whereas it works fine with Mozilla.

%matplotlib inline will lead to static images of your plot embedded in the notebook, so that cannot be the solution for this prevailing issue.

like image 28
Akshar Patel Avatar answered Oct 07 '22 01:10

Akshar Patel