@@ -275,15 +275,17 @@ class TestScalarFormatter(object):
275275
276276 use_offset_data = [True , False ]
277277
278+ # (sci_type, scilimits, lim, orderOfMag, fewticks)
278279 scilimits_data = [
279- (False , (0 , 0 ), (10.0 , 20.0 ), 0 ),
280- (True , (- 2 , 2 ), (- 10 , 20 ), 0 ),
281- (True , (- 2 , 2 ), (- 20 , 10 ), 0 ),
282- (True , (- 2 , 2 ), (- 110 , 120 ), 2 ),
283- (True , (- 2 , 2 ), (- 120 , 110 ), 2 ),
284- (True , (- 2 , 2 ), (- .001 , 0.002 ), - 3 ),
285- (True , (0 , 0 ), (- 1e5 , 1e5 ), 5 ),
286- (True , (6 , 6 ), (- 1e5 , 1e5 ), 6 ),
280+ (False , (0 , 0 ), (10.0 , 20.0 ), 0 , False ),
281+ (True , (- 2 , 2 ), (- 10 , 20 ), 0 , False ),
282+ (True , (- 2 , 2 ), (- 20 , 10 ), 0 , False ),
283+ (True , (- 2 , 2 ), (- 110 , 120 ), 2 , False ),
284+ (True , (- 2 , 2 ), (- 120 , 110 ), 2 , False ),
285+ (True , (- 2 , 2 ), (- .001 , 0.002 ), - 3 , False ),
286+ (True , (- 7 , 7 ), (0.18e10 , 0.83e10 ), 9 , True ),
287+ (True , (0 , 0 ), (- 1e5 , 1e5 ), 5 , False ),
288+ (True , (6 , 6 ), (- 1e5 , 1e5 ), 6 , False ),
287289 ]
288290
289291 @pytest .mark .parametrize ('left, right, offset' , offset_data )
@@ -316,14 +318,18 @@ def test_use_offset(self, use_offset):
316318 assert use_offset == tmp_form .get_useOffset ()
317319
318320 @pytest .mark .parametrize (
319- 'sci_type, scilimits, lim, orderOfMag' , scilimits_data )
320- def test_scilimits (self , sci_type , scilimits , lim , orderOfMag ):
321+ 'sci_type, scilimits, lim, orderOfMag, fewticks' , scilimits_data )
322+ def test_scilimits (self , sci_type , scilimits , lim , orderOfMag ,
323+ fewticks ):
321324 tmp_form = mticker .ScalarFormatter ()
322325 tmp_form .set_scientific (sci_type )
323326 tmp_form .set_powerlimits (scilimits )
324327 fig , ax = plt .subplots ()
325328 ax .yaxis .set_major_formatter (tmp_form )
326329 ax .set_ylim (* lim )
330+ if fewticks :
331+ ax .yaxis .set_major_locator (mticker .MaxNLocator (4 ))
332+
327333 tmp_form .set_locs (ax .yaxis .get_majorticklocs ())
328334 assert orderOfMag == tmp_form .orderOfMagnitude
329335
0 commit comments