8000 Added test. · matplotlib/matplotlib@49f03f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49f03f7

Browse files
committed
Added test.
1 parent 8ae213c commit 49f03f7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,24 @@ def test_scatter_color_warning(self, kwargs):
27652765
plt.scatter([], [], c=[], **kwargs)
27662766
plt.scatter([1, 2], [3, 4], c=[4, 5], **kwargs)
27672767

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+
27682786
def test_scatter_unfilled(self):
27692787
coll = plt.scatter([0, 1, 2], [1, 3, 2], c=['0.1', '0.3', '0.5'],
27702788
marker=mmarkers.MarkerStyle('o', fillstyle='none'),

0 commit comments

Comments
 (0)
0