@@ -3315,6 +3315,25 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3315
3315
3316
3316
self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
3317
3317
3318
+ # Make sure all the args are iterable; use lists not arrays to preserve
3319
+ # units.
3320
+ if not np .iterable (x ):
3321
+ x = [x ]
3322
+
3323
+ if not np .iterable (y ):
3324
+ y = [y ]
3325
+
3326
+ if len (x ) != len (y ):
3327
+ raise ValueError ("'x' and 'y' must have the same size" )
3328
+
3329
+ if xerr is not None :
3330
+ if not np .iterable (xerr ):
3331
+ xerr = [xerr ] * len (x )
3332
+
3333
+ if yerr is not None :
3334
+ if not np .iterable (yerr ):
3335
+ yerr = [yerr ] * len (y )
3336
+
3318
3337
plot_line = (fmt .lower () != 'none' )
3319
3338
label = kwargs .pop ("label" , None )
3320
3339
@@ -3339,24 +3358,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3339
3358
base_style ['color' ] = 'C0'
3340
3359
if ecolor is None :
3341
3360
ecolor = base_style ['color' ]
3342
- # make sure all the args are iterable; use lists not arrays to
3343
- # preserve units
3344
- if not np .iterable (x ):
3345
- x = [x ]
3346
-
3347
- if not np .iterable (y ):
3348
- y = [y ]
3349
-
3350
- if len (x ) != len (y ):
3351
- raise ValueError ("'x' and 'y' must have the same size" )
3352
-
3353
- if xerr is not None :
3354
- if not np .iterable (xerr ):
3355
- xerr = [xerr ] * len (x )
3356
-
3357
- if yerr is not None :
3358
- if not np .iterable (yerr ):
3359
- yerr = [yerr ] * len (y )
3360
3361
3361
3362
# make the style dict for the 'normal' plot line
3362
3363
plot_line_style = {
@@ -3366,9 +3367,14 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3366
3367
kwargs ['zorder' ] + .1 ),
3367
3368
}
3368
3369
3369
- # make the style dict for the line collections (the bars)
3370
+ # Make the style dict for the line collections (the bars), ejecting any
3371
+ # marker information from format string.
3370
3372
eb_lines_style = dict (base_style )
3371
3373
eb_lines_style .pop ('marker' , None )
3374
+ eb_lines_style .pop ('markersize' , None )
3375
+ eb_lines_style .pop ('markerfacecolor' , None )
3376
+ eb_lines_style .pop ('markeredgewidth' , None )
3377
+ eb_lines_style .pop ('markeredgecolor' , None )
3372
3378
eb_lines_style .pop ('linestyle' , None )
3373
3379
eb_lines_style ['color' ] = ecolor
3374
3380
@@ -3381,14 +3387,14 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3381
3387
if key in kwargs :
3382
3388
eb_lines_style [key ] = kwargs [key ]
3383
3389
3384
- # set up cap style dictionary
3390
+ # Make the style dict for the caps, ejecting any marker information
3391
+ # from format string.
3385
3392
eb_cap_style = dict (base_style )
3386
- # eject any marker information from format string
3387
3393
eb_cap_style .pop ('marker' , None )
3388
- eb_lines_style .pop ('markerfacecolor ' , None )
3389
- eb_lines_style .pop ('markeredgewidth ' , None )
3390
- eb_lines_style .pop ('markeredgecolor ' , None )
3391
- eb_cap_style .pop ('ls ' , None )
3394
+ eb_cap_style .pop ('markersize ' , None )
3395
+ eb_cap_style .pop ('markerfacecolor ' , None )
3396
+ eb_cap_style .pop ('markeredgewidth ' , None )
3397
+ eb_cap_style .pop ('markeredgecolor ' , None )
3392
3398
eb_cap_style ['linestyle' ] = 'none'
3393
3399
if capsize is None :
3394
3400
capsize = rcParams ["errorbar.capsize" ]
0 commit comments