@@ -1233,23 +1233,24 @@ def test_imshow_quantitynd():
12331233 fig .canvas .draw ()
12341234
12351235
1236+ @pytest .mark .parametrize ('x' , [- 1 , 1 ])
12361237@check_figures_equal (extensions = ['png' ])
1237- def test_huge_range_log (fig_test , fig_ref ):
1238- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1238+ def test_huge_range_log (fig_test , fig_ref , x ):
1239+ # parametrize over bad lognorm -1 values and large range 1 -> 1e20
1240+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
12391241 data [0 :2 , :] = 1E20
12401242
12411243 ax = fig_test .subplots ()
1242- im = ax .imshow (data , norm = colors .LogNorm (vmin = 100 , vmax = data .max ()),
1243- interpolation = 'nearest' , cmap = 'viridis' )
1244+ ax .imshow (data , norm = colors .LogNorm (vmin = 1 , vmax = data .max ()),
1245+ interpolation = 'nearest' , cmap = 'viridis' )
12441246
1245- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1247+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
12461248 data [0 :2 , :] = 1000
12471249
1248- cmap = copy (plt .get_cmap ('viridis' ))
1249- cmap .set_under ('w' )
12501250 ax = fig_ref .subplots ()
1251- im = ax .imshow (data , norm = colors .Normalize (vmin = 100 , vmax = data .max ()),
1252- interpolation = 'nearest' , cmap = cmap )
1251+ cmap = plt .get_cmap ('viridis' ).with_extremes (under = 'w' )
1252+ ax .imshow (data , norm = colors .Normalize (vmin = 1 , vmax = data .max ()),
1253+ interpolation = 'nearest' , cmap = cmap )
12531254
12541255
12551256@check_figures_equal ()
0 commit comments