8000 Add scatter color len mismatch ValueError test · matplotlib/matplotlib@e218bcf · GitHub
[go: up one dir, main page]

Skip to content

Commit e218bcf

Browse files
committed
Add scatter color len mismatch ValueError test
1 parent 28b4f51 commit e218bcf

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4800,15 +4800,10 @@ def test_fillbetween_cycle():
48004800

48014801

48024802
@cleanup
4803-
def test_log_margins():
4804-
plt.rcParams['axes.autolimit_mode'] = 'data'
4803+
def test_color_length_mismatch():
4804+
N = 500
4805+
x, y = np.random.rand(N), np.random.rand(N)
4806+
colors = np.random.rand(N+1)
48054807
fig, ax = plt.subplots()
4806-
margin = 0.05
4807-
ax.set_xmargin(margin)
4808-
ax.semilogx([1, 10], [1, 10])
4809-
xlim0, xlim1 = ax.get_xlim()
4810-
transform = ax.xaxis.get_transform()
4811-
xlim0t, xlim1t = transform.transform([xlim0, xlim1])
4812-
x0t, x1t = transform.transform([1, 10])
4813-
delta = (x1t - x0t) * margin
4814-
assert_allclose([xlim0t + delta, xlim1t - delta], [x0t, x1t])
4808+
with pytest.raises(ValueError):
4809+
ax.scatter(x, y, c=colors)

0 commit comments

Comments
 (0)
0