I am getting closer to the results I want by modifying my days and hours locators to read:
days = WeekdayLocator(byweekday=(MO, TU, WE, TH, FR)) hours = HourLocator(byhour=range(9,17,1)) but the xaxis still fills in times for the rest of each day interval, but now only shows xtick labels for the period during the day i am concerned with. Is there a way to limit the hours plotted on the xaxis for each day interval? On Tue, 2006-09-26 at 16:47 -0400, Richard Albright wrote: > I am trying to figure out how i can use IndexLocator with DateFormatter. > Currently i am only using DayLocator and HourLocator in my code, but it > is showing ticks for all hours in the plot, when I only care about > plotting the hours for when data is available. > > I already applied date2num to my dates in the x list below. > > > > from matplotlib.dates import IndexDateFormatter, DateFormatter, date2num > > import matplotlib > > from matplotlib import rc > > import datetime > from pylab import * > > > x = [732559.39583333337, 732559.40625, 732559.41666666663, > 732559.42708333337, > 732559.4375, 732559.44791666663, 732559.45833333337, 732559.46875, > 732559.47916666663 , 732559.48958333337, 732559.5, > 732559.51041666663, > 732559.52083333337, 732559.53125, 732559.54166666663, > 732559.55208333337, > 732559.5625, 732559.57291666663, 732559.58333333337, 732559.59375, > 732559.60416666663, 732559.61458333337, 732559.625, > 732559.63541666663, > 732559.64583333337, 732559.65625, 732559.66666666663, > 732560.39583333337, > 732560.40625, 732560.41666666663, 732560.42708333337, 732560.4375, > 732560.44791666663, 732560.45833333337, 732560.46875, > 732560.47916666663, > 732560.48958333337, 732560.5, 732560.51041666663, > 732560.52083333337, > 732560.53125, 732560.54166666663, 732560.55208333337, 732560.5625, > 732560.57291666663, 732560.58333333337, 732560.59375, > 732560.60416666663, > 732560.61458333337, 732560.625, 732560.63541666663, > 732560.64583333337, > 732560.65625, 732560.66666666663] > y = [13.07, 13.050000000000001, 13.029999999999999, 13.039999999999999, > 13.029999999999999, 13.0, 13.0, 13.0, 13.0, 13.029999999999999, > 13.02, > 13.01, 12.99, 12.98, 12.98, 12.960000000000001, 12.94, 12.92, > 12.960000000000001, 12.98, 13.19, 13.140000000000001, > 13.130000000000001, > 13.109999999999999, 13.08, 13.109999999999999, 13.039999999999999, > 13.15, > 13.130000000000001, 13.15, 13.279999999999999, 13.210000000000001, > 13.199999999999999, 13.199999999999999, 13.19, 13.199999999999999, > 13.140000000000001, 13.119999999999999, 13.1, 13.09, > 13.130000000000001, > 13.119999999999999, 13.130000000000001, 13.130000000000001, > 13.140000000000001, 13.15, 13.16, 13.119999999999999, > 13.119999999999999, > 13.1, 13.050000000000001, 13.029999999999999, 13.02, 13.0] > > datesindex = range(len(x)) > > days = DayLocator() > hours = HourLocator() > ax = subplot(111) > plot(x, y) > > ax.xaxis.set_major_locator(days) > ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d %H:%M:%S')) > ax.xaxis.set_minor_locator(hours) > ax.xaxis.set_minor_formatter(DateFormatter('%H:%M:%S')) > setp(ax.get_xticklabels(), 'rotation', 90, 'horizontalalignment', > 'center', fontsize=8) > minorlabels = [tick.label1 for tick in ax.xaxis.get_minor_ticks()] > setp(minorlabels, 'rotation', 90, 'horizontalalignment', 'center', > fontsize=8) > > grid(True) > show() > > Any suggestions would be greatly appreciated. > -- Rick Albright Senior Quantitvative Analyst Indie Research, LLC 254 Witherspoon Street Princeton, NJ 08542 (609)497-1030 [EMAIL PROTECTED] ------------------------------------------------------------------------- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users