@@ -2723,7 +2723,7 @@ def broken_barh(self, xranges, yrange, **kwargs):
2723
2723
2724
2724
@_preprocess_data ()
2725
2725
def stem (self , * args , linefmt = None , markerfmt = None , basefmt = None , bottom = 0 ,
2726
- label = None , use_line_collection = True , vertical = False ):
2726
+ label = None , use_line_collection = True , orientation = 'horizontal' ):
2727
2727
"""
2728
2728
Create a stem plot.
2729
2729
@@ -2774,8 +2774,9 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2774
2774
basefmt : str, default: 'C3-' ('C2-' in classic mode)
2775
2775
A format string defining the properties of the baseline.
2776
2776
2777
- vertical : bool, optional (False)
2778
- If 'True', will produce a vertically-oriented stem plot.
2777
+ orientation : string, optional (horizontal)
2778
+ If 'vertical', will produce a vertically-oriented stem plot,
2779
+ else it will produce a horizontally-oriented stem plot.
2779
2780
2780
2781
bottom : float, default: 0
2781
2782
The y-position of the baseline.
@@ -2866,12 +2867,12 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2866
2867
basestyle , basemarker , basecolor = _process_plot_format (basefmt )
2867
2868
2868
2869
# Check if the user wants a vertical stem plot
2869
- if vertical :
2870
+ if orientation == ' vertical' :
2870
2871
x , y = y , x
2871
2872
2872
2873
# New behaviour in 3.1 is to use a LineCollection for the stemlines
2873
2874
if use_line_collection :
2874
- if vertical :
2875
+ if orientation == ' vertical' :
2875
2876
stemlines = [((bottom , yi ), (xi , yi )) for xi , yi in zip (x , y )]
2876
2877
else :
2877
2878
stemlines = [((xi , bottom ), (xi , yi )) for xi , yi in zip (x , y )]
@@ -2885,7 +2886,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2885
2886
else :
2886
2887
stemlines = []
2887
2888
for xi , yi in zip (x , y ):
2888
- if vertical :
2889
+ if orientation == ' vertical' :
2889
2890
xs = [bottom , xi ]
2890
2891
ys = [yi , yi ]
2891
2892
else :
@@ -2898,7 +2899,9 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2898
2899
2899
2900
markerline , = self .plot (x , y , color = markercolor , linestyle = markerstyle ,
2900
2901
marker = markermarker , label = "_nolegend_" )
2901
- if vertical :
2902
+
2903
+ if orientation == 'vertical' :
2904
+ x , y = y , x
2902
2905
baseline , = self .plot ([bottom , bottom ], [np .min (x ), np .max (x )],
2903
2906
color = basecolor , linestyle = basestyle ,
2904
2907
marker = basemarker , label = "_nolegend_" )
0 commit comments