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 4134c8d

Browse filesBrowse files
committed
Clarify error message for bad-dimensionality in pcolorfast().
1 parent 6799367 commit 4134c8d
Copy full SHA for 4134c8d

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+11
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6591,7 +6591,10 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
65916591
elif x.ndim == 2 and y.ndim == 2:
65926592
style = "quadmesh"
65936593
else:
6594-
raise TypeError("arguments do not match valid signatures")
6594+
raise TypeError(
6595+
f"When 3 positional parameters are passed to pcolorfast, the first "
6596+
f"two (X and Y) must be both 1D or both 2D; the given X was "
6597+
f"{x.ndim}D and the given Y was {y.ndim}D")
65956598
else:
65966599
raise _api.nargs_error('pcolorfast', '1 or 3', len(args))
65976600

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6450,6 +6450,13 @@ def test_pcolorfast(xy, data, cls):
64506450
assert type(ax.pcolorfast(*xy, data)) == cls
64516451

64526452

6453+
def test_pcolorfast_bad_dims():
6454+
fig, ax = plt.subplots()
6455+
with pytest.raises(
6456+
TypeError, match=("the given X was 1D and the given Y was 2D")):
6457+
ax.pcolorfast(np.empty(6), np.empty((4, 7)), np.empty((8, 8)))
6458+
6459+
64536460
def test_shared_scale():
64546461
fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
64556462

0 commit comments

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