@@ -1233,23 +1233,24 @@ def test_imshow_quantitynd():
1233
1233
fig .canvas .draw ()
1234
1234
1235
1235
1236
+ @pytest .mark .parametrize ('x' , [- 1 , 1 ])
1236
1237
@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 )
1239
1241
data [0 :2 , :] = 1E20
1240
1242
1241
1243
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' )
1244
1246
1245
- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1247
+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
1246
1248
data [0 :2 , :] = 1000
1247
1249
1248
- cmap = copy (plt .get_cmap ('viridis' ))
1249
- cmap .set_under ('w' )
1250
1250
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 )
1253
1254
1254
1255
1255
1256
@check_figures_equal ()
0 commit comments