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 cba8e7d

Browse filesBrowse files
chahak13tacaswell
andcommitted
Update lib/matplotlib/contour.py
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
1 parent 92a5b02 commit cba8e7d
Copy full SHA for cba8e7d

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+6
-3
lines changed

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,10 @@ def _contour_args(self, args, kwargs):
14561456
kwargs
14571457
)
14581458
elif (("X" in kwargs) ^ ("Y" in kwargs)) and "Z" in kwargs:
1459-
raise KeyError("Both 'X' and 'Y' must be passed as kwargs. "
1460-
"Passing only one of the two is not allowed.")
1459+
raise TypeError(
1460+
"Both or neither 'X' and 'Y' may be passed as kwargs. "
1461+
"Passing only one of the two is not allowed."
1462+
)
14611463
elif "Z" in kwargs:
14621464
z = ma.asarray(kwargs.pop("Z"), dtype=np.float64)
14631465
x, y = self._initialize_x_y(z)

‎lib/matplotlib/tests/test_contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_contour.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ def test_contour_xyz_kwargsonly():
710710

711711

712712
def test_contour_either_xy():
713-
with pytest.raises(KeyError, match="Both 'X' and 'Y' must be passed"):
713+
with pytest.raises(TypeError,
714+
match="Both or neither 'X' and 'Y' may be passed"):
714715
plt.contour(
715716
X=np.random.rand(30, 30),
716717
Z=np.random.rand(30, 30)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.