如何在matplotlib中繪製多個酒吧,當我試圖多次調用酒吧功能,他們重疊,並看到下圖所示的最高值紅色只能看到。 如何繪製x軸上日期的多個小節?蟒蛇matplotlib多個酒吧
到目前爲止,我想這:
import matplotlib.pyplot as plt
import datetime
x = [datetime.datetime(2011, 1, 4, 0, 0),
datetime.datetime(2011, 1, 5, 0, 0),
datetime.datetime(2011, 1, 6, 0, 0)]
y = [4, 9, 2]
z=[1,2,3]
k=[11,12,13]
ax = plt.subplot(111)![enter image description here][1]
ax.bar(x, y,width=0.5,color='b',align='center')
ax.bar(x, z,width=0.5,color='g',align='center')
ax.bar(x, k,width=0.5,color='r',align='center')
ax.xaxis_date()
plt.show()
我得到這個:
的結果應該是這樣的,但是隨着日期是在x軸和酒吧旁邊的每個其他:
您需要更改x值 – jterrace
你是什麼意思? X值是日期... –