Skip to content

Commit

Permalink
DOC: better unit argument errors axes.bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jklymak committed Jan 17, 2019
1 parent 7b40990 commit 67f23c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -2267,10 +2267,20 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
# left, bottom, width, height vectors
if align == 'center':
if orientation == 'vertical':
left = x - width / 2
try:
left = x - width / 2
except TypeError as e:
raise TypeError(f'the dtypes of parameters x ({x.dtype}) '
f'and width ({width.dtype}) '
f'are incompatible') from e
bottom = y
elif orientation == 'horizontal':
bottom = y - height / 2
try:
bottom = y - height / 2
except TypeError as e:
raise TypeError(f'the dtypes of parameters y ({y.dtype}) '
f'and height ({height.dtype}) '
f'are incompatible') from e
left = x
elif align == 'edge':
left = x
Expand Down

0 comments on commit 67f23c2

Please sign in to comment.