@@ -2765,6 +2765,24 @@ def test_scatter_color_warning(self, kwargs):
2765
2765
plt .scatter ([], [], c = [], ** kwargs )
2766
2766
plt .scatter ([1 , 2 ], [3 , 4 ], c = [4 , 5 ], ** kwargs )
2767
2767
2768
+ @pytest .mark .parametrize ('colors' ,
2769
+ [
2770
+ ('red' , 'blue' ), # simple string colors
2771
+ (['red' , 'blue' ], ['green' , 'yellow' ]), # array of colors
2772
+ ([[1 , 0 , 0 ], [0 , 1 , 0 ]], [[0 , 0 , 1 ], [1 , 1 , 0 ]]) # RGB values
2773
+ ])
2774
+ def test_scatter_c_facecolor_warning (self , colors ):
2775
+ warn_match = (
2776
+ "You passed both c and facecolor/facecolors for the markers. "
2777
+ "c has precedence over facecolor/facecolors. This behavior may "
2778
+ "change in the future."
2779
+ )
2780
+ fig , ax = plt .subplots ()
2781
+ x = [0 , 1 ] if len (colors [0 ]) == 2 else [0 ]
2782
+ y = x
2783
+ with pytest .warns (UserWarning , match = warn_match ):
2784
+ ax .scatter (x , y , c = colors [0 ], facecolors = colors [1 ])
2785
+
2768
2786
def test_scatter_unfilled (self ):
2769
2787
coll = plt .scatter ([0 , 1 , 2 ], [1 , 3 , 2 ], c = ['0.1' , '0.3' , '0.5' ],
2770
2788
marker = mmarkers .MarkerStyle ('o' , fillstyle = 'none' ),
0 commit comments