I have a small matplotlib app I wrote to plot columns of a CSV files. The X axis is almost always time. Once displayed, I will often zoom in on a small patch of a plot. I'm currently selecting the strftime format based on the original time range of the input. As I zoom in, however, that doesn't work so well. Consider the attached plot.
How do I trigger a recalculation of the X axis format? I see this class, which looks promising: http://matplotlib.org/api/dates_api.html#matplotlib.dates.AutoDateFormatter but when I use it in the obvious way, all I get is the current year for all tick labels, despite the fact that the scaled attribute of the formatter has keys which are much smaller than a year. formatter = matplotlib.dates.AutoDateFormatter( matplotlib.dates.AutoDateLocator()) print formatter.scaled The default scaled attribute displays as: {1.0: '%b %d %Y', 365.0: '%Y', 30.0: '%b %Y', 0.041666666666666664: '%H:%M:%S'} I'm plotting data now with a range of about four hours, so I think the last format (%H:%M:%S) should be used. Thx, Skip
<<attachment: trend4.png>>
------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users