Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.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
以日期为x轴的Python脚本_Python_Date_Plot_Scripting - Fatal编程技术网

以日期为x轴的Python脚本

以日期为x轴的Python脚本,python,date,plot,scripting,Python,Date,Plot,Scripting,我犯了很多错误。有人在代码中看到像thorn一样突出的东西吗 from pylab import plot, show, title, xlabel, ylabel, legend import matplotlib.dates as dates title('AF16 compared to AF17') xlabel('Month') ylabel('Donation Amount') legend([af16y, af17y]) af16x = dates.datestr2num[1/1/

我犯了很多错误。有人在代码中看到像thorn一样突出的东西吗

from pylab import plot, show, title, xlabel, ylabel, legend
import matplotlib.dates as dates
title('AF16 compared to AF17')
xlabel('Month')
ylabel('Donation Amount')
legend([af16y, af17y])
af16x = dates.datestr2num[1/1/15,3/5/16]
af17x = dates.datestr2num[4/5/16, 2/2/17]
af16y = [3000,5000]
af17y = [350,7000]
plot(af16x,af16y,af17x,af17y)

大多数情况下,我知道图例和日期会导致错误。这是一个schmorgasborg的代码,所以我知道我遇到了错误。非常感谢您的帮助。

您遇到了什么错误?datestr2num是一个函数,它接受日期的字符串表示列表。看一看,我得到了一个关于图例的错误:NameError:name'af16y'没有定义我只是注释掉图例,然后我得到了这个错误:af16x=dates.datestr2num[1/1/15,3/15/16]TypeError:'function'对象不是subscriptableanyone正在寻求关于这个概念的帮助,请转到这里: