Hi, I get unexpected behaviour using the script below. xticks only appear in
the 4th subplot. If the lines marked ### are moved out of the loop (and edited
so that they are constants), then xticks do appear on each subplot. Is this a
bug or am I missing something?
I am using matplotlib 1.1.0svn.
Many thanks, Evan
import numpy as np
import datetime as dt
import matplotlib.dates as dates
import matplotlib.pyplot as plt
months = dates.MonthLocator(range(1,13), bymonthday=1, interval=1)
monthsFmt = dates.DateFormatter("%b %Y")
deltad = 2
delta = dt.timedelta(days=deltad)
plt.close('all')
fig1 = plt.figure(1)
for i in range(4):
date_str = dt.date(i+2,11,1) ###
date_end = dt.date(i+3,3,1) ###
date_range = dates.drange(date_str,date_end,delta) ###
ax = fig1.add_subplot(2,2,i+1)
ax.plot_date(date_range,np.sin(date_range))
ax.xaxis.set_major_locator(months)
ax.xaxis.set_major_formatter(monthsFmt)
plt.show()