Skip to content

Commit c9ed617

Browse files
authored
Merge pull request #13162 from jklymak/doc-better-argcheck-bar
DOC: better argcheck bar
2 parents 7b40990 + 67f23c2 commit c9ed617

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/matplotlib/axes/_axes.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -2267,10 +2267,20 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22672267
# left, bottom, width, height vectors
22682268
if align == 'center':
22692269
if orientation == 'vertical':
2270-
left = x - width / 2
2270+
try:
2271+
left = x - width / 2
2272+
except TypeError as e:
2273+
raise TypeError(f'the dtypes of parameters x ({x.dtype}) '
2274+
f'and width ({width.dtype}) '
2275+
f'are incompatible') from e
22712276
bottom = y
22722277
elif orientation == 'horizontal':
2273-
bottom = y - height / 2
2278+
try:
2279+
bottom = y - height / 2
2280+
except TypeError as e:
2281+
raise TypeError(f'the dtypes of parameters y ({y.dtype}) '
2282+
f'and height ({height.dtype}) '
2283+
f'are incompatible') from e
22742284
left = x
22752285
elif align == 'edge':
22762286
left = x

0 commit comments

Comments
 (0)