@@ -3522,10 +3522,13 @@ def pie(self, x, explode=None, labels=None,
35223522
35233523 def errorbar (self , x , y , yerr = None , xerr = None ,
35243524 fmt = '-' , ecolor = None , capsize = 3 ,
3525- barsabove = False , ** kwargs ):
3525+ barsabove = False , lolims = False , uplims = False ,
3526+ xlolims = False , xuplims = False , ** kwargs ):
35263527 """
35273528 ERRORBAR(x, y, yerr=None, xerr=None,
3528- fmt='b-', ecolor=None, capsize=3, barsabove=False)
3529+ fmt='b-', ecolor=None, capsize=3, barsabove=False,
3530+ lolims=False, uplims=False,
3531+ xlolims=False, xuplims=False)
35293532
35303533 Plot x versus y with error deltas in yerr and xerr.
35313534 Vertical errorbars are plotted if yerr is not None
@@ -3554,6 +3557,11 @@ def errorbar(self, x, y, yerr=None, xerr=None,
35543557 barsabove, if True, will plot the errorbars above the plot symbols
35553558 - default is below
35563559
3560+ lolims, uplims, xlolims, xuplims: These arguments can be used
3561+ to indicate that a value gives only upper/lower limits. In
3562+ that case a caret symbol is used to indicate this. lims-arguments
3563+ may be of the same type as xerr and yerr.
3564+
35573565 kwargs are passed on to the plot command for the markers.
35583566 So you can add additional key=value pairs to control the
35593567 errorbar markers. For example, this code makes big red
@@ -3579,18 +3587,18 @@ def errorbar(self, x, y, yerr=None, xerr=None,
35793587 if not self ._hold : self .cla ()
35803588
35813589 # make sure all the args are iterable arrays
3582- if not iterable (x ): x = npy .asarray ([x ])
3590+ if not iterable (x ): x = npy .array ([x ])
35833591 else : x = npy .asarray (x )
35843592
3585- if not iterable (y ): y = npy .asarray ([y ])
3593+ if not iterable (y ): y = npy .array ([y ])
35863594 else : y = npy .asarray (y )
35873595
35883596 if xerr is not None :
3589- if not iterable (xerr ): xerr = npy .asarray ([xerr ])
3597+ if not iterable (xerr ): xerr = npy .array ([xerr ])
35903598 else : xerr = npy .asarray (xerr )
35913599
35923600 if yerr is not None :
3593- if not iterable (yerr ): yerr = npy .asarray ([yerr ])
3601+ if not iterable (yerr ): yerr = npy .array ([yerr ])
35943602 else : yerr = npy .asarray (yerr )
35953603
35963604 l0 = None
@@ -3607,6 +3615,18 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36073615 if 'lw' in kwargs :
36083616 lines_kw ['lw' ]= kwargs ['lw' ]
36093617
3618+ if not iterable (lolims ): lolims = npy .array ([lolims ]* len (x ), bool )
3619+ else : lolims = npy .asarray (lolims , bool )
3620+
3621+ if not iterable (uplims ): uplims = npy .array ([uplims ]* len (x ), bool )
3622+ else : uplims = npy .asarray (uplims , bool )
3623+
3624+ if not iterable (xlolims ): xlolims = npy .array ([xlolims ]* len (x ), bool )
3625+ else : xlolims = npy .asarray (xlolims , bool )
3626+
3627+ if not iterable (xuplims ): xuplims = npy .array ([xuplims ]* len (x ), bool )
3628+ else : xuplims = npy .asarray (xuplims , bool )
3629+
36103630 if capsize > 0 :
36113631 plot_kw = {
36123632 'ms' :2 * capsize ,
@@ -3626,8 +3646,19 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36263646
36273647 barcols .append ( self .hlines (y , left , right , ** lines_kw ) )
36283648 if capsize > 0 :
3629- caplines .extend ( self .plot (left , y , 'k|' , ** plot_kw ) )
3630- caplines .extend ( self .plot (right , y , 'k|' , ** plot_kw ) )
3649+ if xlolims .any ():
3650+ caplines .extend ( self .plot (left [xlolims ], y [xlolims ], ls = 'None' , marker = mlines .CARETLEFT , ** plot_kw ) )
3651+ xlolims = ~ xlolims
3652+ caplines .extend ( self .plot (left [xlolims ], y [xlolims ], 'k|' , ** plot_kw ) )
3653+ else :
3654+ caplines .extend ( self .plot (left , y , 'k|' , ** plot_kw ) )
3655+
3656+ if xuplims .any ():
3657+ caplines .extend ( self .plot (right [xuplims ], y [xuplims ], ls = 'None' , marker = mlines .CARETRIGHT , ** plot_kw ) )
3658+ xuplims = ~ xuplims
3659+ caplines .extend ( self .plot (right [xuplims ], y [xuplims ], 'k|' , ** plot_kw ) )
3660+ else :
3661+ caplines .extend ( self .plot (right , y , 'k|' , ** plot_kw ) )
36313662
36323663 if yerr is not None :
36333664 if len (yerr .shape ) == 1 :
@@ -3639,8 +3670,20 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36393670
36403671 barcols .append ( self .vlines (x , lower , upper , ** lines_kw ) )
36413672 if capsize > 0 :
3642- caplines .extend ( self .plot (x , lower , 'k_' , ** plot_kw ) )
3643- caplines .extend ( self .plot (x , upper , 'k_' , ** plot_kw ) )
3673+
3674+ if lolims .any ():
3675+ caplines .extend ( self .plot (x [lolims ], lower [lolims ], ls = 'None' , marker = mlines .CARETDOWN , ** plot_kw ) )
3676+ lolims = ~ lolims
3677+ caplines .extend ( self .plot (x [lolims ], lower [lolims ], 'k_' , ** plot_kw ) )
3678+ else :
3679+ caplines .extend ( self .plot (x , lower , 'k_' , ** plot_kw ) )
3680+
3681+ if uplims .any ():
3682+ caplines .extend ( self .plot (x [uplims ], upper [uplims ], ls = 'None' , marker = mlines .CARETUP , ** plot_kw ) )
3683+ uplims = ~ uplims
3684+ caplines .extend ( self .plot (x [uplims ], upper [uplims ], 'k_' , ** plot_kw ) )
3685+ else :
3686+ caplines .extend ( self .plot (x , upper , 'k_' , ** plot_kw ) )
36443687
36453688 if not barsabove and fmt is not None :
36463689 l0 , = self .plot (x ,y ,fmt ,** kwargs )
0 commit comments