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 11, 2019
1 parent 912eb07 commit c6efd9f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -2274,10 +2274,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}) '
'are incompatible') from e
bottom = y
elif orientation == 'horizontal':
bottom = y - height / 2
try:
bottom = y - height / 2
except TypeError as e:
raise ValueError(f'the dtypes of parameters y ({y.dtype}) '
f'and height ({height.dtype}) '
'are incompatible') from e
left = x
elif align == 'edge':
left = x
Expand Down

0 comments on commit c6efd9f

Please sign in to comment.