Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 显示脚本中的情节_Python_Pandas_Plot - Fatal编程技术网

Python 显示脚本中的情节

Python 显示脚本中的情节,python,pandas,plot,Python,Pandas,Plot,我有一个脚本(不是IPython笔记本),它在最后生成一个绘图(通过pandasDataFrame)。我的问题是,这样的情节没有表现出来 灵感来源于我的努力 fig, ax = plt.subplots() my_dataframe.plot(ax=ax) ax.show() 这是行不通的。我可以显示我的绘图的唯一方法是: plt.figure() my_dataframe.plot() plt.show() 但这也带来了一个我不想要的空数字。你试过了吗 fig, ax = plt.subp

我有一个脚本(不是IPython笔记本),它在最后生成一个绘图(通过pandas
DataFrame
)。我的问题是,这样的情节没有表现出来

灵感来源于我的努力

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

对于不习惯这些缩写的人:plt引用
import matplotlib.pyplot as plt