Skip to content

Commit 2eefb4d

Browse files
author
Hans Dembinski
committed
take capsize from rcParams, key: errorbar.capsize
1 parent 7f9fb69 commit 2eefb4d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,8 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
18621862
18631863
capsize : integer, optional
18641864
determines the length in points of the error bar caps
1865-
default: 3
1865+
default: None, which will take the value from the
1866+
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
18661867
18671868
error_kw : dict, optional
18681869
dictionary of kwargs to be passed to errorbar method. *ecolor* and
@@ -1928,7 +1929,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
19281929
yerr = kwargs.pop('yerr', None)
19291930
error_kw = kwargs.pop('error_kw', dict())
19301931
ecolor = kwargs.pop('ecolor', None)
1931-
capsize = kwargs.pop('capsize', 3)
1932+
capsize = kwargs.pop('capsize', rcParams["errorbar.capsize"])
19321933
error_kw.setdefault('ecolor', ecolor)
19331934
error_kw.setdefault('capsize', capsize)
19341935

@@ -2189,8 +2190,10 @@ def barh(self, bottom, width, height=0.8, left=None, **kwargs):
21892190
ecolor : scalar or array-like, optional, default: None
21902191
specifies the color of errorbar(s)
21912192
2192-
capsize : integer, optional, default: 3
2193+
capsize : integer, optional
21932194
determines the length in points of the error bar caps
2195+
default: None, which will take the value from the
2196+
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
21942197
21952198
error_kw :
21962199
dictionary of kwargs to be passed to errorbar method. `ecolor` and
@@ -2583,7 +2586,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
25832586

25842587
@docstring.dedent_interpd
25852588
def errorbar(self, x, y, yerr=None, xerr=None,
2586-
fmt='', ecolor=None, elinewidth=None, capsize=3,
2589+
fmt='', ecolor=None, elinewidth=None, capsize=None,
25872590
barsabove=False, lolims=False, uplims=False,
25882591
xlolims=False, xuplims=False, errorevery=1, capthick=None,
25892592
**kwargs):
@@ -2630,7 +2633,8 @@ def errorbar(self, x, y, yerr=None, xerr=None,
26302633
The linewidth of the errorbar lines. If *None*, use the linewidth.
26312634
26322635
*capsize*: scalar
2633-
The length of the error bar caps in points
2636+
The length of the error bar caps in points; if *None*, it will
2637+
take the value from ``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
26342638
26352639
*capthick*: scalar
26362640
An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This
@@ -2783,6 +2787,8 @@ def xywhere(xs, ys, mask):
27832787
return xs, ys
27842788

27852789
plot_kw = {'label': '_nolegend_'}
2790+
if capsize is None:
2791+
capsize = rcParams["errorbar.capsize"]
27862792
if capsize > 0:
27872793
plot_kw['ms'] = 2. * capsize
27882794
if capthick is not None:

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,9 @@ def __call__(self, s):
623623
validate_negative_linestyle_legacy],
624624
'contour.corner_mask': [True, validate_corner_mask],
625625

626+
# errorbar props
627+
'errorbar.capsize': [3, validate_float],
628+
626629
# axes props
627630
'axes.axisbelow': [False, validate_bool],
628631
'axes.hold': [True, validate_bool],

matplotlibrc.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ backend : %(backend)s
363363
#contour.negative_linestyle : dashed # dashed | solid
364364
#contour.corner_mask : True # True | False | legacy
365365

366+
### ERRORBAR PLOTS
367+
#errorbar.capsize : 3 # length of end cap on error bars in pixels
368+
366369
### Agg rendering
367370
### Warning: experimental, 2008/10/10
368371
#agg.path.chunksize : 0 # 0 to disable; values in the range

0 commit comments

Comments
 (0)