@@ -1213,23 +1213,24 @@ def test_imshow_quantitynd():
12131213 fig .canvas .draw ()
12141214
12151215
1216+ @pytest .mark .parametrize ('x' , [- 1 , 1 ])
12161217@check_figures_equal (extensions = ['png' ])
1217- def test_huge_range_log (fig_test , fig_ref ):
1218- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1218+ def test_huge_range_log (fig_test , fig_ref , x ):
1219+ # parametrize over bad lognorm -1 values and large range 1 -> 1e20
1220+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
12191221 data [0 :2 , :] = 1E20
12201222
12211223 ax = fig_test .subplots ()
1222- im = ax .imshow (data , norm = colors .LogNorm (vmin = 100 , vmax = data .max ()),
1223- interpolation = 'nearest' , cmap = 'viridis' )
1224+ ax .imshow (data , norm = colors .LogNorm (vmin = 1 , vmax = data .max ()),
1225+ interpolation = 'nearest' , cmap = 'viridis' )
12241226
1225- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1227+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
12261228 data [0 :2 , :] = 1000
12271229
1228- cmap = copy (plt .get_cmap ('viridis' ))
1229- cmap .set_under ('w' )
12301230 ax = fig_ref .subplots ()
1231- im = ax .imshow (data , norm = colors .Normalize (vmin = 100 , vmax = data .max ()),
1232- interpolation = 'nearest' , cmap = cmap )
1231+ cmap = plt .get_cmap ('viridis' ).with_extremes (under = 'w' )
1232+ ax .imshow (data , norm = colors .Normalize (vmin = 1 , vmax = data .max ()),
1233+ interpolation = 'nearest' , cmap = cmap )
12331234
12341235
12351236@check_figures_equal ()
0 commit comments