简体   繁体   English

%matplotlib笔记本在Jupyter笔记本中显示空白图标

[英]%matplotlib notebook shows blank icons in Jupyter notebook

I'm trying to create a simple interactive plot with sliders and matplotlib in Jupyter, however, the icons are simply showing a blank square instead? 我正在尝试在Jupyter中使用滑块和matplotlib创建一个简单的交互式图,但是,这些图标只是显示了一个空白方块而不是? Figure below: 下图:

Blank icons using notebook backend 使用笔记本后端的空白图标

Am I missing a dependency? 我缺少依赖吗? I believe I'm using default settings for everything. 我相信所有内容都使用默认设置。

A simplified version of my code is shown below: 我的代码的简化版本如下所示:

%matplotlib notebook
import matplotlib.pyplot as plt
from ipywidgets import FloatSlider, interact

fig = plt.figure(figsize=(10,3))
ax = fig.add_subplot(1, 1, 1)
ax.set_xlabel('time [s]')
ax.set_ylabel('displacement [cm]')
x1, = ax.plot(t,x)

def update(P_l = FloatSlider(min=0,max=4000,step=50,value=1500)):
    x1.set_ydata(x)

    fig.canvas.draw()

interact(update)

Thanks in advance! 提前致谢!

Jupyter Notebook tends to minimize heavy graphs and tables when it exceeds a specific size. 当Jupyter Notebook超过特定大小时,它往往会尽量减少繁重的图形和表格。 Not sure about the accurate answer, But did you try double clicking the left edge of graph? 不确定准确的答案,但是您是否尝试过双击图表的左边缘? It does the job in my windows PC. 它在我的Windows PC中完成了这项工作。

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

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