@@ -113,6 +113,35 @@ def test_RRuleLocator():
113113
114114 fig .savefig ( 'RRuleLocator_bounds' )
115115
116+ @image_comparison (baseline_images = ['DateFormatter_fractionalSeconds' ])
117+ def test_DateFormatter ():
118+ """Test DateFormatter"""
119+ import pylab
120+ from datetime import datetime
121+ import matplotlib .testing .jpl_units as units
122+ units .register ()
123+
124+ # Lets make sure that DateFormatter will allow us to have tick marks
125+ # at intervals of fractional seconds.
126+
127+ t0 = datetime ( 2001 , 1 , 1 , 0 , 0 , 0 )
128+ tf = datetime ( 2001 , 1 , 1 , 0 , 0 , 1 )
129+
130+ fig = pylab .figure ()
131+ ax = pylab .subplot ( 111 )
132+ ax .set_autoscale_on ( True )
133+ ax .plot ( [t0 , tf ], [0.0 , 1.0 ], marker = 'o' )
134+
135+ # rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 )
136+ # locator = mpldates.RRuleLocator( rrule )
137+ # ax.xaxis.set_major_locator( locator )
138+ # ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) )
139+
140+ ax .autoscale_view ()
141+ fig .autofmt_xdate ()
142+
143+ fig .savefig ( 'DateFormatter_fractionalSeconds' )
144+
116145if __name__ == '__main__' :
117146 import nose
118147 nose .runmodule (argv = ['-s' ,'--with-doctest' ], exit = False )
0 commit comments