简体   繁体   English

%matplotlib 内联与 ​​%matplotlib 笔记本在 pythonAnywhere jupyter 中的显示问题

[英]%matplotlib inline versus %matplotlib notebook display problems in pythonAnywhere jupyter

This is not a duplicate as suggested.这不是建议的重复。 I am not trying to switch backends.我不是要切换后端。 I am just trying to use the %matplotlib notebook formulation.我只是想使用%matplotlib notebook公式。 Moreover, the solutions suggested in that other question ( place the %matplotlib notebook before the the from matplotlib import pylplot as plt OR trying call the magic command twice in a row ) do not work for me.此外,在另一个问题中建议的解决方案(%matplotlib notebook放在from matplotlib import pylplot as plt或尝试连续两次调用魔术命令)对我不起作用。 The behavior (blank notebook charts) remains.行为(空白笔记本图表)仍然存在。


place the %matplotlib notebook before the the from matplotlib import pylplot as plt OR trying call the magic command twice in a row%matplotlib notebook放在from matplotlib import pylplot as plt或者尝试连续两次调用魔法命令

When I use %matplotlib inline my charts always show, but they're generally on the small side, and have no ability to zoom/pan.当我使用%matplotlib inline我的图表总是显示,但它们通常很小,并且无法缩放/平移。

When I use %matplotlib notebook I get zoomable, pannable charts, but I sometimes encounter problems where the charts display as blank.当我使用%matplotlib notebook我会得到可缩放、可平移的图表,但有时我会遇到图表显示为空白的问题。

在此处输入图片说明

Background:背景:

PythonAnywhere notebook 3.6 Python. PythonAnywhere 笔记本 3.6 Python。 Using update Google Chrome from Windows 7.从 Windows 7 使用更新 Google Chrome。

If I reopen my existing notebook, even restart the kernel and re-run all the cells, all my .plot() appear blank.如果我重新打开现有笔记本,甚至重新启动内核并重新运行所有单元格,我的所有.plot()都会显示为空白。 But if I contemporaneously start a brand new 3.6 notebook, %matplotlib notebook plots work fine.但是如果我同时启动一个全新的 3.6 笔记本, %matplotlib notebook绘图工作正常。 Killing all the jupyter-related processes doesn't help either.杀死所有与 jupyter 相关的进程也无济于事。

This does not always occur.这并不总是发生。 But if one chart appears blank, they all appear blank.但是,如果一张图表显示为空白,则它们都显示为空白。

I would like to use the notebook magic, but this problem is pretty profound.我想使用notebook魔法,但这个问题相当深刻。

在此处输入图片说明

I have found some stability on using %matplotlib notebook, after including plt.close() , before all my plots.在包含plt.close() ,在我的所有绘图之前,我发现使用%matplotlib notebook 具有一定的稳定性。

A pretty dirty solution, I know, but it's working.我知道这是一个非常肮脏的解决方案,但它有效。 Here Windows 10, Python 3.6.2 and Jupyter 6.03 (updated Jupyter haven't solved the issue).这里是 Windows 10、Python 3.6.2 和 Jupyter 6.03(更新后的 Jupyter 还没有解决问题)。 Hope this helps.希望这会有所帮助。

%matplotlib qt会完成你的工作。

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

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