[SciPy-User] milliseconds in matplotlib.dates?

Tom Kuiper kuiper at jpl.nasa.gov
Thu Mar 25 17:17:17 EDT 2010


> Date: Thu, 25 Mar 2010 13:17:01 -0500
> From: G?khan Sever <gokhansever at gmail.com>
> Subject: Re: [SciPy-User] milliseconds in matplotlib.dates?
> To: SciPy Users List <scipy-user at scipy.org>
> Cc: Matplotlib Users <matplotlib-users at lists.sourceforge.net>
>   
...
> Alternatively, you might use just floating-point version of your time values
> and with a little adjustment (Ryan mentioned this in the recently, and will
> forward there for other suggestions) millisecond resolutions should be
> visible when zoomed in furthest.
>
> Something like:
>
> sci_fmt = plt.FormatStrFormatter("%.2f")
> plt.gca().xaxis.set_major_formatter(sci_fmt)
>   
Here's how I modified my code:
sci_fmt = FormatStrFormatter("%.2f")
fig = figure()
top_axes = subplot(211)
top_axes.xaxis.set_major_formatter(sci_fmt)
#plot_date(times,kurts,fmt='b-')
#plot_date(times,kurt_sm,fmt='r-',label=("Hamming 1-sec FWHM"))
plot(times,kurts,'b-')
plot(times,kurt_sm,'r-',label=("Hamming 1-sec FWHM"))
I then restarted 'ipython -pylab' because I've noticed that date 
formatting problems seems to linger even after a code change.  However, 
I see no change in behaviour.  I can get six 1-sec ticks across my 
plot.  If I expand the plot any more, the ticks disappear.

Regards

Tom



More information about the SciPy-User mailing list