【发布时间】:2014-08-27 23:29:29
【问题描述】:
我的python 绘图数据仅在 x 轴上显示 2 个点。
我想要更多,但不知道如何。
x = [ datetime.datetime(1900,1,1,0,1,2),
datetime.datetime(1900,1,1,0,1,3),
...
] # ( more than 1000 elements )
y = [ 34, 33, 23, ............ ]
plt.plot( x, y )
X 轴仅显示 2 个间隔点。我尝试使用.xticks,但不适用于 X 轴。
它给出了以下错误:
TypeError: object of type 'datetime.datetime' has no len()
【问题讨论】:
-
你用的是什么版本的mpl?
-
我真的不明白你的问题。
-
您确定只显示 2 个点吗?您可以这样做来查看绘图认为它对数据的看法: plt.gca().lines[0].get_data() 这些点是否可能靠得太近了?
标签: python matplotlib