I have a DataFrame
that contains price/volume data on an intraday basis:
time price volume
2015-04-15 10:10:00 10 500
2015-04-15 10:20:00 15 100
2015-04-15 10:30:00 20 70
2015-04-15 10:30:00 etc etc
I need to get a standard price - volume chart, where the top chart contains the prices (a regular line), and the bottom chart contains the volume (a bar chart).
Both charts should share the same axis, of course.
So far, I have come up with:
plt.figure(figsize=(20,15))
ax1=plt.subplot2grid((2,2),(0,0),colspan=2)
ax2=plt.subplot2grid((2,2),(1,0),colspan=2)
ax2.xaxis.set_major_locator(HourLocator(interval=3))
ax2.xaxis.set_major_formatter(DateFormatter('%H:%M'))
data.ix['2015-10-01': '2015-10-02','price'].plot(ax=ax1)
data.ix['2015-10-01': '2015-10-02','volume'].plot(ax=ax2, kind='bar')
But I get super-dense tick labels for the bar charts (the chart is unusable).
How can I simply specify to have minor ticks every hours, and major ticks every 3 hours (so that the chart is still readable)?