77from numpy .testing .utils import assert_array_equal
88import matplotlib .colors as mcolors
99import matplotlib .cm as cm
10+ import matplotlib .pyplot as plt
11+ from matplotlib .testing .decorators import cleanup
12+
1013
1114def test_colormap_endian ():
1215 """
@@ -23,6 +26,7 @@ def test_colormap_endian():
2326 #print(anative.dtype.isnative, aforeign.dtype.isnative)
2427 assert_array_equal (cmap (anative ), cmap (aforeign ))
2528
29+
2630def test_BoundaryNorm ():
2731 """
2832 Github issue #1258: interpolation was failing with numpy
@@ -36,6 +40,7 @@ def test_BoundaryNorm():
3640 ncolors = len (boundaries )
3741 bn = mcolors .BoundaryNorm (boundaries , ncolors )
3842 assert_array_equal (bn (vals ), expected )
43+
3944
4045def test_LogNorm ():
4146 """
@@ -46,3 +51,10 @@ def test_LogNorm():
4651 ln = mcolors .LogNorm (clip = True , vmax = 5 )
4752 assert_array_equal (ln ([1 , 6 ]), [0 , 1.0 ])
4853
54+
55+ @cleanup
56+ def test_autoscale_masked ():
57+ # Test for #2336. Previously fully masked data would trigger a ValueError.
58+ data = np .ma .masked_all ((12 , 20 ))
59+ plt .pcolor (data )
60+ plt .draw ()
0 commit comments