Greetings. I've been having lots of luck with my date plots. But
I've been having a problem getting the dateformatter to work. I'm
using the code below. The dates keep getting formatted with the
default, "Sep 28 2006" instead of what I want, "Sep 28"
Any thoughts?
from datetime import date,timedelta
from matplotlib.dates import MonthLocator, WeekdayLocator,
DateFormatter,MONDAY,SATURDAY
from pylab import *
def dateplot():
dates = drange(date(2006,10,1),date(2006,12,1),timedelta(days=1))
vals = 500*(randn(len(dates))+2)
figure(num=1, figsize=(6.5,4))
axes([.15,.3,.8,.5])
ax = gca() # get the current graphics
region
title(r"Average daily bandwidth")
ax.xaxis.set_major_formatter(DateFormatter('%b %d'))
ax.yaxis.set_major_formatter(FormatStrFormatter('%3.0f KBps'))
plot_date(dates, vals, 'bo')
# Rotate the labels
labels = ax.get_xticklabels()
setp(labels,'rotation',90,fontsize=8)
grid(True)
savefig("x.pdf",format='pdf')
if(__name__=='__main__'):
dateplot()
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users