ManUtdBloke
ManUtdBloke

Reputation: 453

Jupyter notebook no longer opens matplotlib plots in external window?

I have been using Jupyter notebook and matplotlib for several weeks now without any problems. I used the following code at the start of my notebook cells to make matplotlib plot into an external window:

%matplotlib notebook

However, today when I run these cells it plots the figure in the same window at the end of the cell right after my code. It puts the interactive options into this plot so it is note the same as using %matplotlib inline.

I need to plot these figures in external windows, not in the same window so what can I do to fix this issue? I tried restarting the kernel and rebooting my PC and relaunching Jupyter notebook, neither worked.

So does anyone know how I can make Jupyter notebook plot matplotlib figures in external windows like it used to?

Edit: I have also tried using the other matplotlib backends (qt, tk, etc..) and they don't make a difference, it still puts the plot at the end of the cell instead of in an external window. I have included a picture below of the plot appearing at the end of the cell.

enter image description here

Upvotes: 4

Views: 8611

Answers (2)

ManUtdBloke
ManUtdBloke

Reputation: 453

What worked was:

  1. Restart the kernel
  2. Call %matplotlib qt5

Output is then shown in an external window.

Upvotes: 3

To plot in external window

%matplotlib qt

To plot inside the jupyter notebook

%matplotlib inline 

I hope this helps!

Upvotes: 7

Related Questions