简体   繁体   English

Jupyter笔记本不再在外部窗口打开matplotlib图?

[英]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. 我已经使用Jupyter笔记本和matplotlib几个星期了,没有任何问题。 I used the following code at the start of my notebook cells to make matplotlib plot into an external window: 我在笔记本单元格的开头使用了以下代码,将matplotlib绘制到外部窗口:

%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 . 它将交互式选项放入此图中,因此它与使用%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. 我尝试重新启动内核并重新启动我的PC并重新启动Jupyter笔记本,但都没有工作。

So does anyone know how I can make Jupyter notebook plot matplotlib figures in external windows like it used to? 那么有谁知道我怎么能像以前一样在外部窗口中制作Jupyter笔记本绘图matplotlib数字?

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. 编辑:我也尝试使用其他matplotlib后端(qt,tk等等)并且它们没有区别,它仍然将绘图放在单元格的末尾而不是外部窗口。 I have included a picture below of the plot appearing at the end of the cell. 我在下面列出了出现在单元格末尾的情节。

在此输入图像描述

To plot in external window 在外部窗口中绘图

%matplotlib qt

To plot inside the jupyter notebook 在jupyter笔记本内部绘图

%matplotlib inline 

I hope this helps! 我希望这有帮助!

What worked was: 有用的是:

  1. Restart the kernel 重启内核
  2. Call %matplotlib qt5 调用%matplotlib qt5

Output is then shown in an external window. 然后输出显示在外部窗口中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM