嵌入式IPython中的matplotlib.plot立即显示图,没有机会修改返回的轴

将IPython嵌入脚本并运行:

from IPython import embed

# code ...
embed()

%matplotlib
#^ With or without; same result

fig = plt.figure()

目前fig无法执行任何操作。

已经show n并显示窗口,
即使我从未打电话给show

plt.show() # does absolutely nothing
qqqwwweebao 回答:嵌入式IPython中的matplotlib.plot立即显示图,没有机会修改返回的轴

我通常以这种方式在IPython中导入matplotlib:

%matplotlib inline
import matplotlib.pyplot as plt
ax,fig = plt.subplots()
plt.plot([[1,1],[2,2]])
plt.show()

有帮助吗?

本文链接:https://www.f2er.com/3014539.html

大家都在问