我有一个脚本(不是 IPython 笔记本)在最后生成一个图(通过 pandas DataFrame)。我的问题是没有显示这样的情节。
灵感来自 this我试过了
fig, ax = plt.subplots()
my_dataframe.plot(ax=ax)
ax.show()
这是行不通的。我可以展示我的情节的唯一方法是:
plt.figure()
my_dataframe.plot()
plt.show()
但这也带来了一个我不想拥有的空数字。
请您参考如下方法:
你试过吗
fig, ax = plt.subplots()
my_dataframe.plot(ax=ax)
plt.show() # plt in place of ax
