@@ -3573,10 +3573,11 @@ def _upcast_err(err):
35733573 eb_cap_style ['color' ] = ecolor
35743574
35753575 barcols = []
3576- caplines = []
3576+ caplines = { 'x' : [], 'y' : []}
35773577
35783578 # Vectorized fancy-indexer.
3579- def apply_mask (arrays , mask ): return [array [mask ] for array in arrays ]
3579+ def apply_mask (arrays , mask ):
3580+ return [array [mask ] for array in arrays ]
35803581
35813582 # dep: dependent dataset, indep: independent dataset
35823583 for (dep_axis , dep , err , lolims , uplims , indep , lines_func ,
@@ -3607,9 +3608,12 @@ def apply_mask(arrays, mask): return [array[mask] for array in arrays]
36073608 # return dep - elow * ~lolims, dep + ehigh * ~uplims
36083609 # except that broadcast_to would strip units.
36093610 low , high = dep + np .row_stack ([- (1 - lolims ), 1 - uplims ]) * err
3610-
36113611 barcols .append (lines_func (
36123612 * apply_mask ([indep , low , high ], everymask ), ** eb_lines_style ))
3613+ if self .name == "polar" and dep_axis == "x" :
3614+ for b in barcols :
3615+ for p in b .get_paths ():
3616+ p ._interpolation_steps = 2
36133617 # Normal errorbars for points without upper/lower limits.
36143618 nolims = ~ (lolims | uplims )
36153619 if nolims .any () and capsize > 0 :
@@ -3622,7 +3626,7 @@ def apply_mask(arrays, mask): return [array[mask] for array in arrays]
36223626 line = mlines .Line2D (indep_masked , indep_masked ,
36233627 marker = marker , ** eb_cap_style )
36243628 line .set (** {f"{ dep_axis } data" : lh_masked })
3625- caplines .append (line )
3629+ caplines [ dep_axis ] .append (line )
36263630 for idx , (lims , hl ) in enumerate ([(lolims , high ), (uplims , low )]):
36273631 if not lims .any ():
36283632 continue
@@ -3636,15 +3640,29 @@ def apply_mask(arrays, mask): return [array[mask] for array in arrays]
36363640 line = mlines .Line2D (x_masked , y_masked ,
36373641 marker = hlmarker , ** eb_cap_style )
36383642 line .set (** {f"{ dep_axis } data" : hl_masked })
3639- caplines .append (line )
3643+ caplines [ dep_axis ] .append (line )
36403644 if capsize > 0 :
3641- caplines .append (mlines .Line2D (
3645+ caplines [ dep_axis ] .append (mlines .Line2D (
36423646 x_masked , y_masked , marker = marker , ** eb_cap_style ))
3643-
3644- for l in caplines :
3645- self .add_line (l )
3647+ if self .name == 'polar' :
3648+ for axis in caplines :
3649+ for l in caplines [axis ]:
3650+ # Rotate caps to be perpendicular to the error bars
3651+ for theta , r in zip (l .get_xdata (), l .get_ydata ()):
3652+ rotation = mtransforms .Affine2D ().rotate (theta )
3653+ if axis == 'y' :
3654+ rotation .rotate (- np .pi / 2 )
3655+ ms = mmarkers .MarkerStyle (marker = marker ,
3656+ transform = rotation )
3657+ self .add_line (mlines .Line2D ([theta ], [r ], marker = ms ,
3658+ ** eb_cap_style ))
3659+ else :
3660+ for axis in caplines :
3661+ for l in caplines [axis ]:
3662+ self .add_line (l )
36463663
36473664 self ._request_autoscale_view ()
3665+ caplines = caplines ['x' ] + caplines ['y' ]
36483666 errorbar_container = ErrorbarContainer (
36493667 (data_line , tuple (caplines ), tuple (barcols )),
36503668 has_xerr = (xerr is not None ), has_yerr = (yerr is not None ),
0 commit comments