1

When plotting a Series with a PeriodIndex, pandas always locates the xlabels on the beginning of a Period:

DATA = pd.Series(np.random.randn(120), index=pd.period_range("2013-01", "2012-12", freq="M"))
DATA.plot(ax=plt.gca())

So in this case, the annual labels (2003, ... 2012) are located at the first of January of each year. How can I have the annual labels centered horintally, while keeping the xticks at their places?

So in my example, I want the major_xticks located on each Jan 1st, but the label "2012" be centered between 2012-01-01 and 2013-01-01.

andreas-h
  • 10,679
  • 18
  • 60
  • 78
  • pandas date formatting works quite well with auto formatting, however it is difficult to adapt it. you can achieve this by using matplotlib, see [this question](http://stackoverflow.com/q/12945971/1301710) – bmu Mar 25 '13 at 19:55

0 Answers0