Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f65b5b

Browse files
committed
Merge pull request #5607 from anntzer/clarify-bad-shape-error
ENH: Clarify error when plot() args have bad shapes.
2 parents 95b67ff + dd4dc1a commit 2f65b5b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ def _xy_from_xy(self, x, y):
220220
x = _check_1d(x)
221221
y = _check_1d(y)
222222
if x.shape[0] != y.shape[0]:
223-
raise ValueError("x and y must have same first dimension")
223+
raise ValueError("x and y must have same first dimension, but "
224+
"have shapes {} and {}".format(x.shape, y.shape))
224225
if x.ndim > 2 or y.ndim > 2:
225-
raise ValueError("x and y can be no greater than 2-D")
226+
raise ValueError("x and y can be no greater than 2-D, but have "
227+
"shapes {} and {}".format(x.shape, y.shape))
226228

227229
if x.ndim == 1:
228230
x = x[:, np.newaxis]

0 commit comments

Comments
 (0)