@@ -467,6 +467,35 @@ def test_imshow():
467467 ax .set_ylim (0 , 3 )
468468
469469
470+ @check_figures_equal (extensions = ['png' ])
471+ def test_imshow_10_10_1 (fig_test , fig_ref ):
472+ # 10x10x1 should be the same as 10x10
473+ arr = np .arange (100 ).reshape ((10 , 10 , 1 ))
474+ ax = fig_ref .subplots ()
475+ ax .imshow (arr [:, :, 0 ], interpolation = "bilinear" , extent = (1 , 2 , 1 , 2 ))
476+ ax .set_xlim (0 , 3 )
477+ ax .set_ylim (0 , 3 )
478+
479+ ax = fig_test .subplots ()
480+ ax .imshow (arr , interpolation = "bilinear" , extent = (1 , 2 , 1 , 2 ))
481+ ax .set_xlim (0 , 3 )
482+ ax .set_ylim (0 , 3 )
483+
484+
485+ def test_imshow_10_10_2 ():
486+ fig , ax = plt .subplots ()
487+ arr = np .arange (200 ).reshape ((10 , 10 , 2 ))
488+ with pytest .raises (TypeError ):
489+ ax .imshow (arr )
490+
491+
492+ def test_imshow_10_10_5 ():
493+ fig , ax = plt .subplots ()
494+ arr = np .arange (500 ).reshape ((10 , 10 , 5 ))
495+ with pytest .raises (TypeError ):
496+ ax .imshow (arr )
497+
498+
470499@image_comparison (['no_interpolation_origin' ], remove_text = True )
471500def test_no_interpolation_origin ():
472501 fig , axs = plt .subplots (2 )
0 commit comments