@@ -1173,6 +1173,8 @@ def update_datalim(self, xys):
11731173 # Otherwise, it will compute the bounds of it's current data
11741174 # and the data in xydata
11751175 xys = npy .asarray (xys )
1176+
1177+
11761178 self .dataLim .update_numerix_xy (xys , - 1 )
11771179
11781180
@@ -3242,21 +3244,6 @@ def make_iterable(x):
32423244
32433245 patches = []
32443246
3245- # lets do some conversions now
3246- if self .xaxis is not None :
3247- xconv = self .xaxis .converter
3248- if xconv is not None :
3249- units = self .xaxis .get_units ()
3250- left = xconv .convert ( left , units )
3251- width = xconv .convert ( width , units )
3252-
3253- if self .yaxis is not None :
3254- yconv = self .yaxis .converter
3255- if yconv is not None :
3256- units = self .yaxis .get_units ()
3257- bottom = yconv .convert ( bottom , units )
3258- height = yconv .convert ( height , units )
3259-
32603247
32613248 if align == 'edge' :
32623249 pass
@@ -3645,23 +3632,24 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36453632 a list of error bar cap lines, the third element is a list of
36463633 line collections for the horizontal and vertical error ranges
36473634 """
3635+
36483636 self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
36493637 if not self ._hold : self .cla ()
36503638
3651- # make sure all the args are iterable arrays
3652- if not iterable (x ): x = npy . array ([ x ])
3653- else : x = npy . asarray ( x )
3639+ # make sure all the args are iterable; use lists not arrays to preserve units
3640+ if not iterable (x ):
3641+ x = [ x ]
36543642
3655- if not iterable (y ): y = npy . array ([ y ])
3656- else : y = npy . asarray ( y )
3643+ if not iterable (y ):
3644+ y = [ y ]
36573645
36583646 if xerr is not None :
3659- if not iterable (xerr ): xerr = npy . array ([ xerr ])
3660- else : xerr = npy . asarray ( xerr )
3647+ if not iterable (xerr ):
3648+ xerr = [ xerr ]
36613649
36623650 if yerr is not None :
3663- if not iterable (yerr ): yerr = npy . array ([ yerr ])
3664- else : yerr = npy . asarray ( yerr )
3651+ if not iterable (yerr ):
3652+ yerr = [ yerr ]
36653653
36663654 l0 = None
36673655
@@ -3677,7 +3665,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36773665 if 'lw' in kwargs :
36783666 lines_kw ['lw' ]= kwargs ['lw' ]
36793667
3680- if not iterable (lolims ): lolims = npy .array ([lolims ]* len (x ), bool )
3668+ # arrays fine here, they are booleans and hence not units
3669+ if not iterable (lolims ):
3670+ lolims = npy .asarray ([lolims ]* len (x ), bool )
36813671 else : lolims = npy .asarray (lolims , bool )
36823672
36833673 if not iterable (uplims ): uplims = npy .array ([uplims ]* len (x ), bool )
@@ -3699,12 +3689,14 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36993689 plot_kw ['mew' ]= kwargs ['mew' ]
37003690
37013691 if xerr is not None :
3702- if len (xerr .shape ) == 1 :
3703- left = x - xerr
3704- right = x + xerr
3692+ if iterable (xerr ) and len (xerr )== 2 :
3693+ # using list comps rather than arrays to preserve units
3694+ left = [thisx - thiserr for (thisx , thiserr ) in zip (x ,xerr [0 ])]
3695+ right = [thisx + thiserr for (thisx , thiserr ) in zip (x ,xerr [1 ])]
37053696 else :
3706- left = x - xerr [0 ]
3707- right = x + xerr [1 ]
3697+ # using list comps rather than arrays to preserve units
3698+ left = [thisx - thiserr for (thisx , thiserr ) in zip (x ,xerr )]
3699+ right = [thisx + thiserr for (thisx , thiserr ) in zip (x ,xerr )]
37083700
37093701 barcols .append ( self .hlines (y , left , right , ** lines_kw ) )
37103702 if capsize > 0 :
@@ -3723,12 +3715,14 @@ def errorbar(self, x, y, yerr=None, xerr=None,
37233715 caplines .extend ( self .plot (right , y , 'k|' , ** plot_kw ) )
37243716
37253717 if yerr is not None :
3726- if len (yerr .shape ) == 1 :
3727- lower = y - yerr
3728- upper = y + yerr
3718+ if iterable (yerr ) and len (yerr )== 2 :
3719+ # using list comps rather than arrays to preserve units
3720+ lower = [thisy - thiserr for (thisy , thiserr ) in zip (y ,yerr [0 ])]
3721+ upper = [thisy + thiserr for (thisy , thiserr ) in zip (y ,yerr [1 ])]
37293722 else :
3730- lower = y - yerr [0 ]
3731- upper = y + yerr [1 ]
3723+ # using list comps rather than arrays to preserve units
3724+ lower = [thisy - thiserr for (thisy , thiserr ) in zip (y ,yerr )]
3725+ upper = [thisy + thiserr for (thisy , thiserr ) in zip (y ,yerr )]
37323726
37333727 barcols .append ( self .vlines (x , lower , upper , ** lines_kw ) )
37343728 if capsize > 0 :
0 commit comments