Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 961fd20

Browse files
committed
Small corrections to errorbar
svn path=/trunk/matplotlib/; revision=3348
1 parent fe54f99 commit 961fd20

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2007-06-02 Have errorbar follow the color cycle even if line is not plotted.
2+
Suppress plotting of errorbar caps for capsize=0. - NN
3+
14
2007-06-02 Set markers to same alpha value as line. - NN
25

36
2007-06-02 Fix mathtext position in svg backend. - NN

lib/matplotlib/axes.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,7 +3427,7 @@ def pie(self, x, explode=None, labels=None,
34273427

34283428

34293429
def errorbar(self, x, y, yerr=None, xerr=None,
3430-
fmt='b-', ecolor=None, capsize=3,
3430+
fmt='-', ecolor=None, capsize=3,
34313431
barsabove=False, **kwargs):
34323432
"""
34333433
ERRORBAR(x, y, yerr=None, xerr=None,
@@ -3517,8 +3517,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
35173517
right = x+xerr[1]
35183518

35193519
barcols.append( self.hlines(y, left, right, label='_nolegend_' ))
3520-
caplines.extend( self.plot(left, y, '|', ms=2*capsize, label='_nolegend_') )
3521-
caplines.extend( self.plot(right, y, '|', ms=2*capsize, label='_nolegend_') )
3520+
if capsize > 0:
3521+
caplines.extend( self.plot(left, y, 'k|', ms=2*capsize, label='_nolegend_') )
3522+
caplines.extend( self.plot(right, y, 'k|', ms=2*capsize, label='_nolegend_') )
35223523

35233524
if yerr is not None:
35243525
if len(yerr.shape) == 1:
@@ -3535,23 +3536,25 @@ def errorbar(self, x, y, yerr=None, xerr=None,
35353536
vlines_kw['lw']=kwargs['lw']
35363537
barcols.append( self.vlines(x, lower, upper, **vlines_kw) )
35373538

3538-
plot_kw = {
3539-
'ms':2*capsize,
3540-
'label':'_nolegend_'}
3541-
if 'markeredgewidth' in kwargs:
3542-
plot_kw['markeredgewidth']=kwargs['markeredgewidth']
3543-
if 'mew' in kwargs:
3544-
plot_kw['mew']=kwargs['mew']
3545-
caplines.extend( self.plot(x, lower, '_', **plot_kw) )
3546-
caplines.extend( self.plot(x, upper, '_', **plot_kw) )
3539+
if capsize > 0:
3540+
plot_kw = {
3541+
'ms':2*capsize,
3542+
'label':'_nolegend_'}
3543+
if 'markeredgewidth' in kwargs:
3544+
plot_kw['markeredgewidth']=kwargs['markeredgewidth']
3545+
if 'mew' in kwargs:
3546+
plot_kw['mew']=kwargs['mew']
3547+
caplines.extend( self.plot(x, lower, 'k_', **plot_kw) )
3548+
caplines.extend( self.plot(x, upper, 'k_', **plot_kw) )
35473549

35483550
if not barsabove and fmt is not None:
35493551
l0, = self.plot(x,y,fmt,**kwargs)
35503552

3551-
if ecolor is None and l0 is None:
3552-
ecolor = rcParams['lines.color']
3553-
elif ecolor is None:
3554-
ecolor = l0.get_color()
3553+
if ecolor is None:
3554+
if l0 is None:
3555+
ecolor = self._get_lines._get_next_cycle_color()
3556+
else:
3557+
ecolor = l0.get_color()
35553558

35563559
for l in barcols:
35573560
l.set_color(ecolor)

0 commit comments

Comments
 (0)