@@ -1213,23 +1213,24 @@ def test_imshow_quantitynd():
1213
1213
fig .canvas .draw ()
1214
1214
1215
1215
1216
+ @pytest .mark .parametrize ('x' , [- 1 , 1 ])
1216
1217
@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 )
1219
1221
data [0 :2 , :] = 1E20
1220
1222
1221
1223
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' )
1224
1226
1225
- data = np .full ((5 , 5 ), - 1 , dtype = np .float64 )
1227
+ data = np .full ((5 , 5 ), x , dtype = np .float64 )
1226
1228
data [0 :2 , :] = 1000
1227
1229
1228
- cmap = copy (plt .get_cmap ('viridis' ))
1229
- cmap .set_under ('w' )
1230
1230
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 )
1233
1234
1234
1235
1235
1236
@check_figures_equal ()
0 commit comments