Skip to content

#5856: added option to create vertically-oriented stem plots #6168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
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