@@ -2383,6 +2383,25 @@ def test_scatter_color(self):
23832383 with pytest .raises (ValueError ):
23842384 plt .scatter ([1 , 2 , 3 ], [1 , 2 , 3 ], color = [1 , 2 , 3 ])
23852385
2386+ @pytest .mark .parametrize ('kwargs' ,
2387+ [
2388+ {'cmap' : 'gray' },
2389+ {'norm' : mcolors .Normalize ()},
2390+ {'vmin' : 0 },
2391+ {'vmax' : 0 }
2392+ ])
2393+ def test_scatter_color_warning (self , kwargs ):
2394+ warn_match = "No data for colormapping provided "
2395+ # Warn for cases where 'cmap', 'norm', 'vmin', 'vmax'
2396+ # kwargs are being overridden
2397+ with pytest .warns (Warning , match = warn_match ):
2398+ plt .scatter ([], [], ** kwargs )
2399+ with pytest .warns (Warning , match = warn_match ):
2400+ plt .scatter ([1 , 2 ], [3 , 4 ], c = [], ** kwargs )
2401+ # Do not warn for cases where 'c' matches 'x' and 'y'
2402+ plt .scatter ([], [], c = [], ** kwargs )
2403+ plt .scatter ([1 , 2 ], [3 , 4 ], c = [4 , 5 ], ** kwargs )
2404+
23862405 def test_scatter_unfilled (self ):
23872406 coll = plt .scatter ([0 , 1 , 2 ], [1 , 3 , 2 ], c = ['0.1' , '0.3' , '0.5' ],
23882407 marker = mmarkers .MarkerStyle ('o' , fillstyle = 'none' ),
0 commit comments