Hi,
the code plots a daily average of a parameter through each day of one year. When adding the xaxis ticks to show Months instead of the day number (1...365), the plot of the parameter disappear.
Leaving xticks for each day displays plot just fine.
Thank you for any advice on how to solve my mistery.
Matplotlib version 1.1.0 (EPD 7.3.2)
OS:Linux RedHat 5
Code Snippet:
N = len(avgtol)
X = np.arange(1,N+1)
fig = plt.figure(figsize=figsize_inches)
ax=None
ax = fig.add_subplot(111)
ax.plot(X, Davgtol, label='Mean ' + paramlabel, color='green', linestyle='-')
ax.set_title('%s ' %(paramtitle))
ax.set_ylabel(paramylabel)
# X axis
#months = dates.MonthLocator(bymonthday=15) # try center label on day 15 of each month
months = dates.MonthLocator() # every month
monthsFmt = dates.DateFormatter('%b')
days = dates.DayLocator()
ax.xaxis.set_major_locator(months)
ax.xaxis.set_major_formatter(monthsFmt)
ax.xaxis.set_minor_locator(days)
for tick in ax.xaxis.get_major_ticks():
tick.tick1line.set_markersize(0)
tick.tick2line.set_markersize(0)
tick.label1.set_horizontalalignment('center')
datemin = datetime.date(2014, 1, 1)
datemax = datetime.date(2015, 1, 1)
ax.set_xlim(datemin, datemax)
grid(True)
fig.autofmt_xdate()