返回

nbconvert 导出交互图 - Jupyter

发布时间:2022-08-23 07:43:08 403
# html

我正在尝试使用nbconvert导出一个jupyter笔记本,该笔记本可以维护交互式图形。该图形在笔记本中运行良好,但使用nbconvert后会返回到静态图像。

我尝试了以下命令来维护交互式图形

!jupyter nbconvert Untitled.ipynb --to webpdf --template classic
!jupyter nbconvert --to webpdf --allow-chromium-download Untitled.ipynb
!jupyter nbconvert --to html --execute Untitled.ipynb
!jupyter nbconvert --ExecutePreprocessor.store_widget_state=False --to html --execute Untitled.ipynb


%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interact

x = np.linspace(0, 2 * np.pi)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
line, = ax.plot(x, np.sin(x))

def update(w = 1.0):
    line.set_ydata(np.sin(w * x))
    fig.canvas.draw_idle()

interact(update);

plt.show()

 

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
下一篇
c++-查找美丽置换的所有计数 2022-08-23 05:50:43