Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e218bcf

Browse filesBrowse files
committed
Add scatter color len mismatch ValueError test
1 parent 28b4f51 commit e218bcf
Copy full SHA for e218bcf

File tree

Expand file treeCollapse file tree

1 file changed

+6
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-11
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+6-11Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.