@@ -2779,24 +2779,6 @@ def test_scatter_color_warning(self, kwargs):
2779
2779
plt .scatter ([], [],c = [],** kwargs )
2780
2780
plt .scatter ([1 ,2 ], [3 ,4 ],c = [4 ,5 ],** kwargs )
2781
2781
2782
- @pytest .mark .parametrize ('colors' ,
2783
- [
2784
- ('red' ,'blue' ),
2785
- (['red' ,'blue' ], ['green' ,'yellow' ]),
2786
- ([[1 ,0 ,0 ], [0 ,1 ,0 ]], [[0 ,0 ,1 ], [1 ,1 ,0 ]])
2787
- ])
2788
- def test_scatter_c_facecolor_warning (self ,colors ):
2789
- warn_match = (
2790
- "You passed both c and facecolor/facecolors for the markers. "
2791
- "c has precedence over facecolor/facecolors. This behavior may "
2792
- "change in the future."
2793
- )
2794
- fig ,ax = plt .subplots ()
2795
- x = [0 ,1 ]if len (colors [0 ])== 2 else [0 ]
2796
- y = x
2797
- with pytest .warns (UserWarning ,match = warn_match ):
2798
- ax .scatter (x ,y ,c = colors [0 ],facecolors = colors [1 ])
2799
-
2800
2782
def test_scatter_unfilled (self ):
2801
2783
coll = plt .scatter ([0 ,1 ,2 ], [1 ,3 ,2 ],c = ['0.1' ,'0.3' ,'0.5' ],
2802
2784
marker = mmarkers .MarkerStyle ('o' ,fillstyle = 'none' ),
@@ -3080,6 +3062,55 @@ def get_next_color():
3080
3062
c ,None ,kwargs = {},xsize = 2 ,get_next_color_func = get_next_color )
3081
3063
3082
3064
3065
+ # Warning message tested in the next two tests.
3066
+ WARN_MSG = (
3067
+ "You passed both c and facecolor/facecolors for the markers. "
3068
+ "c has precedence over facecolor/facecolors. This behavior may "
3069
+ "change in the future."
3070
+ )
3071
+ # Test cases shared between direct and integration tests
3072
+ COLOR_TEST_CASES = [
3073
+ ('red' ,'blue' ),
3074
+ (['red' ,'blue' ], ['green' ,'yellow' ]),
3075
+ ([[1 ,0 ,0 ], [0 ,1 ,0 ]], [[0 ,0 ,1 ], [1 ,1 ,0 ]])
3076
+ ]
3077
+
3078
+
3079
+ @pytest .mark .parametrize ('c, facecolor' ,COLOR_TEST_CASES )
3080
+ def test_parse_c_facecolor_warning_direct (c ,facecolor ):
3081
+ """Test the internal _parse_scatter_color_args method directly."""
3082
+ def get_next_color ():
3083
+ return 'blue'
3084
+
3085
+ # Test with facecolors (plural)
3086
+ with pytest .warns (UserWarning ,match = WARN_MSG ):
3087
+ mpl .axes .Axes ._parse_scatter_color_args (
3088
+ c = c ,edgecolors = None ,kwargs = {'facecolors' :facecolor },
3089
+ xsize = 2 ,get_next_color_func = get_next_color )
3090
+
3091
+ # Test with facecolor (singular)
3092
+ with pytest .warns (UserWarning ,match = WARN_MSG ):
3093
+ mpl .axes .Axes ._parse_scatter_color_args (
3094
+ c = c ,edgecolors = None ,kwargs = {'facecolor' :facecolor },
3095
+ xsize = 2 ,get_next_color_func = get_next_color )
3096
+
3097
+
3098
+ @pytest .mark .parametrize ('c, facecolor' ,COLOR_TEST_CASES )
3099
+ def test_scatter_c_facecolor_warning_integration (c ,facecolor ):
3100
+ """Test the warning through the actual scatter plot creation."""
3101
+ fig ,ax = plt .subplots ()
3102
+ x = [0 ,1 ]if isinstance (c , (list ,tuple ))else [0 ]
3103
+ y = x
3104
+
3105
+ # Test with facecolors (plural)
3106
+ with pytest .warns (UserWarning ,match = WARN_MSG ):
3107
+ ax .scatter (x ,y ,c = c ,facecolors = facecolor )
3108
+
3109
+ # Test with facecolor (singular)
3110
+ with pytest .warns (UserWarning ,match = WARN_MSG ):
3111
+ ax .scatter (x ,y ,c = c ,facecolor = facecolor )
3112
+
3113
+
3083
3114
def test_as_mpl_axes_api ():
3084
3115
# tests the _as_mpl_axes api
3085
3116
class Polar :