@@ -3319,25 +3319,31 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
33193319
33203320 had_data = self .has_data ()
33213321
3322- stemlines = []
33233322 jx , jy , jz = art3d .juggle_axes (x , y , z , zdir )
33243323
3325- # plot the baseline in the appropriate plane
3326- for i in range (len (x )- 1 ):
3327- baseline , = Axes .plot (self , [x [i ], x [i + 1 ]], [y [i ], y [i + 1 ]],
3328- basefmt , label = "_nolegend_" )
3329- art3d .line_2d_to_3d (baseline , [bottom , bottom ], zdir )
3330-
3331- # plot the stemlines based on the value of rotate
3332- for thisx , thisy , thisz in zip (x , y , z ):
3333- l , = Axes .plot (self , [thisx , thisx ], [thisy , thisy ], linefmt ,
3334- label = "_nolegend_" )
3335- art3d .line_2d_to_3d (l , [bottom , thisz ], zdir )
3336-
3337- stemlines .append (l )
3338-
3339- markerline , = Axes .plot (self , x , y , markerfmt , label = "_nolegend_" )
3340- art3d .line_2d_to_3d (markerline , z , zdir )
3324+ # Plot the baseline in the appropriate plane.
3325+ baseline , = self .plot (x , y , basefmt , zs = bottom , zdir = zdir ,
3326+ label = '_nolegend_' )
3327+
3328+ # Plot the stemlines based on the value of zdir.
3329+ if zdir [- 1 :] == 'x' :
3330+ lines = [[(bottom , thisy , thisz ), (thisx , thisy , thisz )]
3331+ for thisx , thisy , thisz in zip (jx , jy , jz )]
3332+ elif zdir [- 1 :] == 'y' :
3333+ lines = [[(thisx , bottom , thisz ), (thisx , thisy , thisz )]
3334+ for thisx , thisy , thisz in zip (jx , jy , jz )]
3335+ else :
3336+ lines = [[(thisx , thisy , bottom ), (thisx , thisy , thisz )]
3337+ for thisx , thisy , thisz in zip (jx , jy , jz )]
3338+ linestyle , linemarker , linecolor = _process_plot_format (linefmt )
3339+ if linestyle is None :
3340+ linestyle = rcParams ['lines.linestyle' ]
3341+ stemlines = art3d .Line3DCollection (
3342+ lines , linestyles = linestyle , colors = linecolor , label = '_nolegend_' )
3343+ self .add_collection (stemlines )
3344+
3345+ markerline , = self .plot (x , y , z , markerfmt , zdir = zdir ,
3346+ label = '_nolegend_' )
33413347
33423348 stem_container = StemContainer ((markerline , stemlines , baseline ),
33433349 label = label )
0 commit comments