From: John H. <jdh...@ac...> - 2004-11-06 22:30:15
|
>>>>> "Greg" == Greg Wilson <gvw...@cs...> writes: Greg> Hi. I'm trying to graph the progress of a small software Greg> project over time. My program, and a sample data file, are Greg> attached. If I call ax.autoscale_view(), I get labels on my Greg> X axis, but the graph runs from 2002 to 2006, even though my Greg> data is only for Oct and Nov of 2004. If I comment out the Greg> autoscale_view() call, I get a much more reasonable range, Greg> but lose the ticks on the axis. What am I doing wrong? The problem is you are using a YearLocator for your major ticks. This will place ticks on every year, which is likely not what you want since your date range is only a few days. I see that section of the code is a cut and paste from the date_demo code. plot_date will try and pick the right tick locators and formatters automatically. I suggest you just try plot_date with the default (don't set the locator or formatter manually) and if you are dissatisfied try setting locators and formatters appropriate for the scale of data you are plotting - eg a DayLocator for the major ticks and an hour locator for the minor ones (note you can configure the locators to tick every day, every 2nd day, every 12th hour, etc...) JDH |