On Wed, Sep 24, 2008 at 6:05 AM, Saju Pillai <[EMAIL PROTECTED]> wrote: > Hi, > > Just started playing with matplotlib and it is very impressive. > > I have a question on controlling the x-axis values being plotted. > Say I am recording a stock price every hour from say 10am to 3pm on a > daily basis. I am trying to plot a multi-day chart such that after the > data for 3pm on Day 1 is plotted, the next data should be for 10am on > Day 2. Currently matplotlib is automatically adding all the hours from > 3pm on Day 1 till 10pm on Day 2 even if I am only supplying the x-axis > values that I want to be plotted.
Take a look at the date_index_formatter.py example -- this uses daily data and skips the weekends but it is conceptually similar to your problem http://matplotlib.sourceforge.net/examples/pylab_examples/date_index_formatter.py The approach is to plot evently spaced indices for the xaxis, and then use your date vector as a lookup table for formatting the x locations. The same approach could be used for a date index locator, to put the ticks where you want them. See the chapter on tick locating and formatting in the user's guide for background, and let me know if you get stuck. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users