Skip to content
Closed
Prev Previous commit
Next Next commit
Added some validation for the orientation arg in stem()
  • Loading branch information
vecuenca committed Mar 21, 2016
commit 9ed1e2ebc187747ddb51a7979193eef37f0460a0
3 changes: 3 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,9 @@ def stem(self, *args, **kwargs):
# wants a vertical or horizontal stem plot
orientation = kwargs.pop('orientation', 'horizontal')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably do some validation here to make sure 'aardvark' or the like does not get passed in.


if orientation not in ('horizontal', 'vertical'):
raise ValueError("'%s' is not a valid orientation" % orientation)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bigger change, but could you refactor this to have on if block up here which does the flipping (and maybe rename x, y?) and then the rest of the logic is the same.

bottom = kwargs.pop('bottom', None)
label = kwargs.pop('label', None)

Expand Down