目前,我有 3 个带有 pyplot 的单独窗口......我不想要......我想在一个类似于 jupyter 输出的单个 Web 浏览器窗口中看到我的所有图按顺序“内联”列出,除了我的脚本从作为 ipython 脚本的 Windows 命令行...
# File: plotit.ipy
# toy ipython plotting example
import numpy as np
import matplotlib.pyplot as plt
%matplotlib
t = np.linspace(0, 10, 100)
y1 = 5*t
y2 = -0.5*t
y3 = 2*t**2
# display as 1st inline graph in "jupyter web browser window"
plt.figure()
plt.plot(t,y1)
plt.show()
# display as 2nd inline graph in "jupyter web browser window"
plt.figure()
plt.plot(t,y2)
plt.show()
# display as 3rd inline graph in "jupyter web browser window"
plt.figure()
plt.plot(t,y3, '.')
plt.show()
这是我使用 ActiveState Python 3.6 从命令行运行它的方式:
C:\> ipython
In [1]: %run testit.ipy
Using matplotlib backend: TkAgg
有没有办法将 Jupiter 文档转换为 ipython 脚本,并从命令行将它作为一个整体脚本运行,但仍然让 matplotlib 图在 jupyter 输出窗口中按顺序显示为“内联”脚本。
慕标5832272
天涯尽头无女友
相关分类