On Mon, Oct 8, 2012 at 4:37 PM, Jianbao Tao <jianbao....@gmail.com> wrote: > Problem: The autodatelocator and autodateformatter don't seem to work > properly. One, the formatter doesn't seem to work immediately after being > applied to an axis. A manual call to the locator seems necessary. Two, the > autodatelocator doesn't seem to be able to handle view intervals less than 1 > second, i.e., the tick labels don't show digits beyond second. You can see > this by zooming the example figure from the code below to a level shorter > than one second. > > 1. Operating system: OS X 10.8.2 > 2. matplotlib version: 1.2.0rc2 > 3. I installed matplotlib via: > > pip install > git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev > > 4. Backend: TkAgg, but I don't think the problem depends on the backend. > 5. Code: > #--------------------------------- code > ----------------------------------------------------- > # Running in ipython --pylab mode. > fig = figure() > tsta = num2epoch(date2num(datetime.datetime.now())) > tarr = tsta + arange(0, 60*30., 0.01) # half hour, dt = 0.01 sec > x = np.array(num2date(epoch2num(tarr))) > nt = len(tarr) > y = randn(nt) > > ax = fig.add_subplot(111) > ax.plot(x, y) > fig.canvas.draw() # Show an overall view of the data > > > locator = mpl.dates.AutoDateLocator() > formatter = mpl.dates.AutoDateFormatter(locator) > > formatter.scaled = { > 365.0 : '%Y', > 30. : '%b %Y', > 1.0 : '%b %d', > 1./24. : '%H:%M', > 1./24./60. : '%M:%S', > 1./24./60./60. : '%S', > } > ax.get_xaxis().set_major_formatter(formatter) # Won't work immediately. > locator.set_axis(ax.xaxis) # Have to manually make this call and the one > below. > locator.refresh() # Another manual call. > fig.canvas.draw() > #------------------------------------ end of code > --------------------------------------------------------
I put it on github: https://github.com/matplotlib/matplotlib/issues/1343 -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users