From: Mike A. <mba...@wi...> - 2009-10-24 16:33:11
|
Hi, > * The time ranges are large (one-second samples over a period of > several days) and I find the x axis label formats are often > inappropriate to the scale. How to I control the format of > the x axis labels? > I only started using matplolib a few days ago, but I think I know how to do what you want: ---------------------------------------- import matplotlib.dates as mdates # To read timestamps ... xAxisTimeFormat = '%a\n%H:%M' # Format of time stamps on x-axis hourLocator = mdates.HourLocator(interval=5) # Every 5 hours minuteLocator = mdates.MinuteLocator(interval=30) # Every half hour ... ax.xaxis.set_major_locator(hourLocator) # Set major tick marks ax.xaxis.set_minor_locator(minuteLocator) # Set minor tick marks ax.xaxis.set_major_formatter(mdates.DateFormatter(xAxisTimeFormat)) # Format x-axis labels ---------------------------------------- I have a full example of plots that have a point every minute over the course of days: http://www.hep.wisc.edu/cms/comp/routerqMonitor/index.html with a link to the full python script at the bottom. Mike |