Horizontal Bar Chart With Date In Y Axis
I would like examples of how to plot values of mean, max, min for each date in a clustered horizontal bar chart. dates = [datetime.datetime(2011, 1, 2, 0, 0, 25, 135000), datetime.
Solution 1:
Is this the effect you were looking for?
The key is to use the matplotlib.dates
module to properly format dates:
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
datenum = matplotlib.dates.date2num(dates)
for i in range(-1,len(data_values)-1):
ax.barh(datenum + i*5., data_values[i], height=5.)
ax.yaxis.set_major_formatter(matplotlib.dates.DateFormatter('%m/%d'))
plt.show()
Post a Comment for "Horizontal Bar Chart With Date In Y Axis"