From 5c97b0c72d68f04c90128eb79b0f310e962880a2 Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 20:55:01 -0400 Subject: [PATCH 1/6] Implemented issue #5856 --- lib/matplotlib/axes/_axes.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 49d755ae1954..59f8e5c5fdc1 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2364,8 +2364,8 @@ def stem(self, *args, **kwargs): Call signatures:: - stem(y, linefmt='b-', markerfmt='bo', basefmt='r-') - stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-') + stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) + stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) A stem plot plots vertical lines (using *linefmt*) at each *x* location from the baseline to *y*, and places a marker there @@ -2419,24 +2419,37 @@ def stem(self, *args, **kwargs): basefmt = kwargs.pop('basefmt', args[2]) except IndexError: basefmt = kwargs.pop('basefmt', 'r-') + try: + orientation = kwargs.pop('orientation', args[3]) + except IndexError: + orientation = kwargs.pop('orientation', 'vertical') bottom = kwargs.pop('bottom', None) label = kwargs.pop('label', None) - - markerline, = self.plot(x, y, markerfmt, label="_nolegend_") + if (orientation == "vertical"): + markerline, = self.plot(x, y, markerfmt, label="_nolegend_") + elif (orientation == "horizontal"): + markerline, = self.plot(y, x, markerfmt, label="_nolegend_") if bottom is None: bottom = 0 stemlines = [] for thisx, thisy in zip(x, y): - l, = self.plot([thisx, thisx], [bottom, thisy], linefmt, + if (orientation == "vertical"): + l, = self.plot([thisx, thisx], [bottom, thisy],linefmt, + label="_nolegend_") + elif (orientation == "horizontal"): + l, = self.plot([bottom, thisy], [thisx, thisx], linefmt, label="_nolegend_") stemlines.append(l) - - baseline, = self.plot([np.amin(x), np.amax(x)], [bottom, bottom], + + if (orientation == "vertical"): + baseline, = self.plot([np.amin(x), np.amax(x)],[bottom, bottom], + basefmt, label="_nolegend_") + elif (orientation == "horizontal"): + baseline, = self.plot([bottom, bottom],[np.amin(x), np.amax(x)], basefmt, label="_nolegend_") - self.hold(remember_hold) stem_container = StemContainer((markerline, stemlines, baseline), From 410ef240a38d780394be00b5e8108d3091dcbceb Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 21:14:56 -0400 Subject: [PATCH 2/6] fixed indentation errors --- lib/matplotlib/axes/_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 59f8e5c5fdc1..fd09683566df 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2419,7 +2419,7 @@ def stem(self, *args, **kwargs): basefmt = kwargs.pop('basefmt', args[2]) except IndexError: basefmt = kwargs.pop('basefmt', 'r-') - try: + try: orientation = kwargs.pop('orientation', args[3]) except IndexError: orientation = kwargs.pop('orientation', 'vertical') From 90453d1b9f5ddefedd0fd60913d532a145ec9273 Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 21:20:18 -0400 Subject: [PATCH 3/6] fixed more indentation errors --- lib/matplotlib/axes/_axes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index fd09683566df..db638ab28749 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2426,9 +2426,9 @@ def stem(self, *args, **kwargs): bottom = kwargs.pop('bottom', None) label = kwargs.pop('label', None) - if (orientation == "vertical"): + if (orientation == "vertical"): markerline, = self.plot(x, y, markerfmt, label="_nolegend_") - elif (orientation == "horizontal"): + elif (orientation == "horizontal"): markerline, = self.plot(y, x, markerfmt, label="_nolegend_") if bottom is None: From e7cc3a5dcfbc59852086034795889b27653b0a25 Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 21:27:52 -0400 Subject: [PATCH 4/6] corrected pep8 tests --- lib/matplotlib/axes/_axes.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index db638ab28749..272a6cbda4ac 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2364,8 +2364,10 @@ def stem(self, *args, **kwargs): Call signatures:: - stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) - stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) + stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', + orientation={'vertical'|'horizontal'}) + stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', + orientation={'vertical'|'horizontal'}) A stem plot plots vertical lines (using *linefmt*) at each *x* location from the baseline to *y*, and places a marker there @@ -2443,12 +2445,12 @@ def stem(self, *args, **kwargs): l, = self.plot([bottom, thisy], [thisx, thisx], linefmt, label="_nolegend_") stemlines.append(l) - + if (orientation == "vertical"): - baseline, = self.plot([np.amin(x), np.amax(x)],[bottom, bottom], + baseline, = self.plot([np.amin(x), np.amax(x)],[bottom, bottom], basefmt, label="_nolegend_") elif (orientation == "horizontal"): - baseline, = self.plot([bottom, bottom],[np.amin(x), np.amax(x)], + baseline, = self.plot([bottom, bottom],[np.amin(x), np.amax(x)], basefmt, label="_nolegend_") self.hold(remember_hold) From a4cdd2f5b85077c4a5eaba042880cb08c91406c9 Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 21:43:38 -0400 Subject: [PATCH 5/6] corrected pep8 tests --- lib/matplotlib/axes/_axes.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 272a6cbda4ac..b975c87ee2ae 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2364,9 +2364,9 @@ def stem(self, *args, **kwargs): Call signatures:: - stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', + stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) - stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', + stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', orientation={'vertical'|'horizontal'}) A stem plot plots vertical lines (using *linefmt*) at each *x* @@ -2439,18 +2439,18 @@ def stem(self, *args, **kwargs): stemlines = [] for thisx, thisy in zip(x, y): if (orientation == "vertical"): - l, = self.plot([thisx, thisx], [bottom, thisy],linefmt, - label="_nolegend_") + l, = self.plot([thisx, thisx], [bottom, thisy], linefmt, + label="_nolegend_") elif (orientation == "horizontal"): l, = self.plot([bottom, thisy], [thisx, thisx], linefmt, label="_nolegend_") stemlines.append(l) if (orientation == "vertical"): - baseline, = self.plot([np.amin(x), np.amax(x)],[bottom, bottom], + baseline, = self.plot([np.amin(x), np.amax(x)], [bottom, bottom], basefmt, label="_nolegend_") elif (orientation == "horizontal"): - baseline, = self.plot([bottom, bottom],[np.amin(x), np.amax(x)], + baseline, = self.plot([bottom, bottom], [np.amin(x), np.amax(x)], basefmt, label="_nolegend_") self.hold(remember_hold) From dd834fbe2de3e3be68eeb64e61e93603a27a292d Mon Sep 17 00:00:00 2001 From: ItsRLuo Date: Wed, 16 Mar 2016 22:56:05 -0400 Subject: [PATCH 6/6] corrected BUILD_DOCS fault --- lib/matplotlib/axes/_axes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b975c87ee2ae..1dc54194eaab 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2364,10 +2364,10 @@ def stem(self, *args, **kwargs): Call signatures:: - stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', - orientation={'vertical'|'horizontal'}) - stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', - orientation={'vertical'|'horizontal'}) + stem(y, linefmt='b-', markerfmt='bo', basefmt='r-', + orientation={'vertical'|'horizontal'}) + stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-', + orientation={'vertical'|'horizontal'}) A stem plot plots vertical lines (using *linefmt*) at each *x* location from the baseline to *y*, and places a marker there