Hi List,I find the attached patch useful. It adds an argument (elinewidth) to the errorbar function which is a linewidth analog to the ecolor argument. It allows you to specify a linewidth for the errorbars, so that it can be different from the plot linewidth. This is useful to me because I prefer heavy (lw=2) plot lines, and I also like to de-emphasize the errorbars (elinewidth=1).
Maybe someone else finds this useful? It is probably not the proper way to do it, but would it be possible to add something like this to mpl?
-- Chris
Index: axes.py =================================================================== --- axes.py (revision 5109) +++ axes.py (working copy) @@ -3742,7 +3742,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, - fmt='-', ecolor=None, capsize=3, + fmt='-', ecolor=None, elinewidth=None, capsize=3, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, **kwargs): """ @@ -3773,6 +3773,9 @@ ecolor is a matplotlib color arg which gives the color the errorbar lines; if None, use the marker color. + elinewidth is the linewidth of the errorbar lines; + if None, use the linewidth. + capsize is the size of the error bar caps in points barsabove, if True, will plot the errorbars above the plot symbols @@ -3833,9 +3836,15 @@ lines_kw = {'label':'_nolegend_'} if 'linewidth' in kwargs: - lines_kw['linewidth']=kwargs['linewidth'] + if elinewidth is not None: + lines_kw['linewidth']=elinewidth + else: + lines_kw['linewidth']=kwargs['linewidth'] if 'lw' in kwargs: - lines_kw['lw']=kwargs['lw'] + if elinewidth is not None: + lines_kw['linewidth']=elinewidth + else: + lines_kw['lw']=kwargs['lw'] if 'transform' in kwargs: lines_kw['transform'] = kwargs['transform'] @@ -3893,22 +3902,22 @@ # y are lists leftlo, ylo = xywhere(left, y, xlolims) - caplines.extend( self.plot(leftlo, ylo, ls='None', marker=mlines.CARETLEFT, **plot_kw) ) + caplines.extend( self.plot(leftlo, ylo, ls='None', marker=mlines.CARETLEFT, **lines_kw) ) xlolims = ~xlolims leftlo, ylo = xywhere(left, y, xlolims) - caplines.extend( self.plot(leftlo, ylo, 'k|', **plot_kw) ) + caplines.extend( self.plot(leftlo, ylo, 'k|', **lines_kw) ) else: - caplines.extend( self.plot(left, y, 'k|', **plot_kw) ) + caplines.extend( self.plot(left, y, 'k|', **lines_kw) ) if xuplims.any(): rightup, yup = xywhere(right, y, xuplims) - caplines.extend( self.plot(rightup, yup, ls='None', marker=mlines.CARETRIGHT, **plot_kw) ) + caplines.extend( self.plot(rightup, yup, ls='None', marker=mlines.CARETRIGHT, **lines_kw) ) xuplims = ~xuplims rightup, yup = xywhere(right, y, xuplims) - caplines.extend( self.plot(rightup, yup, 'k|', **plot_kw) ) + caplines.extend( self.plot(rightup, yup, 'k|', **lines_kw) ) else: - caplines.extend( self.plot(right, y, 'k|', **plot_kw) ) + caplines.extend( self.plot(right, y, 'k|', **lines_kw) ) if yerr is not None: if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]): @@ -3925,22 +3934,22 @@ if lolims.any(): xlo, lowerlo = xywhere(x, lower, lolims) - caplines.extend( self.plot(xlo, lowerlo, ls='None', marker=mlines.CARETDOWN, **plot_kw) ) + caplines.extend( self.plot(xlo, lowerlo, ls='None', marker=mlines.CARETDOWN, **lines_kw) ) lolims = ~lolims xlo, lowerlo = xywhere(x, lower, lolims) - caplines.extend( self.plot(xlo, lowerlo, 'k_', **plot_kw) ) + caplines.extend( self.plot(xlo, lowerlo, 'k_', **lines_kw) ) else: - caplines.extend( self.plot(x, lower, 'k_', **plot_kw) ) + caplines.extend( self.plot(x, lower, 'k_', **lines_kw) ) if uplims.any(): xup, upperup = xywhere(x, upper, uplims) - caplines.extend( self.plot(xup, upperup, ls='None', marker=mlines.CARETUP, **plot_kw) ) + caplines.extend( self.plot(xup, upperup, ls='None', marker=mlines.CARETUP, **lines_kw) ) uplims = ~uplims xup, upperup = xywhere(x, upper, uplims) - caplines.extend( self.plot(xup, upperup, 'k_', **plot_kw) ) + caplines.extend( self.plot(xup, upperup, 'k_', **lines_kw) ) else: - caplines.extend( self.plot(x, upper, 'k_', **plot_kw) ) + caplines.extend( self.plot(x, upper, 'k_', **lines_kw) ) if not barsabove and fmt is not None: l0, = self.plot(x,y,fmt,**kwargs)
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users