I'm having trouble deciphering the documentation for changing tick frequency and date formatting with pandas.
For example:
import numpy as np import pandas as pd import pandas.io.data as web import matplotlib as mpl %matplotlib inline mpl.style.use('ggplot') mpl.rcParams['figure.figsize'] = (8,6) # grab some price data px = web.DataReader('AAPL', "yahoo", '2010-12-01')['Adj Close'] px_m = px.asfreq('M', method='ffill') rets_m = px_m.pct_change() rets_m.plot(kind='bar')
generates this plot:
Yikes. How can I get the ticks to be every month or quarter or something sensible? And how can the date formatting be changed to get rid of times?
I've tried various things with ax.set_xticks()
and ax.xaxis.set_major_formatter
but haven't been able to figure it out.