5
5
from matplotlib import rcParams
6
6
from matplotlib .testing .decorators import image_comparison
7
7
from matplotlib .axes import Axes
8
- from matplotlib .ticker import FormatStrFormatter , AutoMinorLocator , FixedFormatter
8
+ from matplotlib .ticker import AutoMinorLocator , FixedFormatter
9
9
import matplotlib .pyplot as plt
10
10
import matplotlib .dates as mdates
11
11
import numpy as np
@@ -237,18 +237,20 @@ def test_figaspect():
237
237
w , h = plt .figaspect (np .zeros ((2 , 2 )))
238
238
assert h / w == 1
239
239
240
+
240
241
def test_autofmt_xdate ():
241
242
for which in [None , 'both' , 'major' , 'minor' ]:
242
243
243
- date = ['3 Jan 2013' , '4 Jan 2013' , '5 Jan 2013' , '6 Jan 2013' , '7 Jan 2013' ,
244
- '8 Jan 2013' , '9 Jan 2013' , '10 Jan 2013' , '11 Jan 2013' , '12 Jan 2013' ,
245
- '13 Jan 2013' , '14 Jan 2013' ]
244
+ date = ['3 Jan 2013' , '4 Jan 2013' , '5 Jan 2013' , '6 Jan 2013' ,
245
+ '7 Jan 2013' , '8 Jan 2013' , '9 Jan 2013' , '10 Jan 2013' , '11 Jan 2013' ,
246
+ '12 Jan 2013' , ' 13 Jan 2013' , '14 Jan 2013' ]
246
247
247
- time = ['16:44:00' , '16:45:00' , '16:46:00' , '16:47:00' , '16:48:00' , '16:49:00' ,
248
- '16:51:00' , '16:52:00' , '16:53:00' , '16:55:00' , '16:56:00' , '16:57:00' ]
248
+ time = ['16:44:00' , '16:45:00' , '16:46:00' , '16:47:00' , '16:48:00' ,
249
+ '16:49:00' , '16:51:00' , '16:52:00' , '16:53:00' , '16:55:00' , '16:56:00' ,
250
+ '16:57:00' ]
249
251
250
252
angle = 60
251
- minors = [1 ,2 , 3 , 4 , 5 , 6 , 7 ]
253
+ minors = [1 , 2 , 3 , 4 , 5 , 6 , 7 ]
252
254
253
255
x = mdates .datestr2num (date )
254
256
y = mdates .datestr2num (time )
@@ -264,7 +266,7 @@ def test_autofmt_xdate():
264
266
265
267
fig .autofmt_xdate (0.2 , angle , 'right' , which )
266
268
267
- if ((which == 'both' ) or (which == 'major' ) or (which == None )):
269
+ if ((which == 'both' ) or (which == 'major' ) or (which is None )):
268
270
for label in fig .axes [0 ].get_xticklabels (False , 'major' ):
269
271
assert (int (label .get_rotation ()) == angle )
270
272
0 commit comments