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
Closed
Prev Previous commit
Next Next commit
Added flipping and renamed xs and ys in stem
  • Loading branch information
vecuenca committed Mar 17, 2016
commit 2b9e65f54f371736b85bd76f4b8262bd0776919f
10 changes: 5 additions & 5 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2448,25 +2448,25 @@ def stem(self, *args, **kwargs):
label = kwargs.pop('label', None)

if vertical:
markerline, = self.plot(y, x, markerfmt, label="_nolegend_")
else:
markerline, = self.plot(x, y, markerfmt, label="_nolegend_")
x, y = y, x

markerline, = self.plot(x, y, markerfmt, label="_nolegend_")

if bottom is None:
bottom = 0

stemlines = []
for thisx, thisy in zip(x, y):
if vertical:
l, = self.plot([bottom, thisy], [thisx, thisx], linefmt,
l, = self.plot([bottom, thisx], [thisy, thisy], linefmt,
label="_nolegend_")
else:
l, = self.plot([thisx, thisx], [bottom, thisy], linefmt,
label="_nolegend_")
stemlines.append(l)

if vertical:
baseline, = self.plot([bottom, bottom], [np.amin(x), np.amax(x)],
baseline, = self.plot([bottom, bottom], [np.amin(y), np.amax(y)],
basefmt, label="_nolegend_")
else:
baseline, = self.plot([np.amin(x), np.amax(x)], [bottom, bottom],
Expand Down