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

Skip to content

capsize with default in matplotlibrc #4449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/users/whats_new/rcparams.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Added ``errorbar.capsize`` key to rcParams
``````````````````````````````````````````
Controls the length of end caps on error bars. If set to zero, errorbars
are turned off by default.

Added ``xtick.minor.visible`` and ``ytick.minor.visible`` key to rcParams
`````````````````````````````````````````````````````````````````````````
Two new keys to control the minor ticks on x/y axis respectively, default set to ``False`` (no minor ticks on the axis).
Expand Down
21 changes: 14 additions & 7 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,9 +1860,10 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
specifies the color of errorbar(s)
default: None

capsize : integer, optional
capsize : scalar, optional
determines the length in points of the error bar caps
default: 3
default: None, which will take the value from the
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.

error_kw : dict, optional
dictionary of kwargs to be passed to errorbar method. *ecolor* and
Expand Down Expand Up @@ -1928,7 +1929,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
yerr = kwargs.pop('yerr', None)
error_kw = kwargs.pop('error_kw', dict())
ecolor = kwargs.pop('ecolor', None)
capsize = kwargs.pop('capsize', 3)
capsize = kwargs.pop('capsize', rcParams["errorbar.capsize"])
error_kw.setdefault('ecolor', ecolor)
error_kw.setdefault('capsize', capsize)

Expand Down Expand Up @@ -2189,8 +2190,10 @@ def barh(self, bottom, width, height=0.8, left=None, **kwargs):
ecolor : scalar or array-like, optional, default: None
specifies the color of errorbar(s)

capsize : integer, optional, default: 3
capsize : scalar, optional
determines the length in points of the error bar caps
default: None, which will take the value from the
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.

error_kw :
dictionary of kwargs to be passed to errorbar method. `ecolor` and
Expand Down Expand Up @@ -2583,7 +2586,7 @@ def pie(self, x, explode=None, labels=None, colors=None,

@docstring.dedent_interpd
def errorbar(self, x, y, yerr=None, xerr=None,
fmt='', ecolor=None, elinewidth=None, capsize=3,
fmt='', ecolor=None, elinewidth=None, capsize=None,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1, capthick=None,
**kwargs):
Expand All @@ -2593,7 +2596,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
Call signature::

errorbar(x, y, yerr=None, xerr=None,
fmt='', ecolor=None, elinewidth=None, capsize=3,
fmt='', ecolor=None, elinewidth=None, capsize=None,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1,
capthick=None)
Expand Down Expand Up @@ -2630,7 +2633,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
The linewidth of the errorbar lines. If *None*, use the linewidth.

*capsize*: scalar
The length of the error bar caps in points
The length of the error bar caps in points; if *None*, it will
take the value from ``errorbar.capsize``
:data:`rcParam<matplotlib.rcParams>`.

*capthick*: scalar
An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This
Expand Down Expand Up @@ -2783,6 +2788,8 @@ def xywhere(xs, ys, mask):
return xs, ys

plot_kw = {'label': '_nolegend_'}
if capsize is None:
capsize = rcParams["errorbar.capsize"]
if capsize > 0:
plot_kw['ms'] = 2. * capsize
if capthick is not None:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ def csd(x, y, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
# changes will be lost
@_autogen_docstring(Axes.errorbar)
def errorbar(x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None,
capsize=3, barsabove=False, lolims=False, uplims=False,
capsize=None, barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1, capthick=None,
hold=None, **kwargs):
ax = gca()
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ def __call__(self, s):
validate_negative_linestyle_legacy],
'contour.corner_mask': [True, validate_corner_mask],

# errorbar props
'errorbar.capsize': [3, validate_float],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is documented as an int in the docstring.


# axes props
'axes.axisbelow': [False, validate_bool],
'axes.hold': [True, validate_bool],
Expand Down
3 changes: 3 additions & 0 deletions matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ backend : %(backend)s
#contour.negative_linestyle : dashed # dashed | solid
#contour.corner_mask : True # True | False | legacy

### ERRORBAR PLOTS
#errorbar.capsize : 3 # length of end cap on error bars in pixels

### Agg rendering
### Warning: experimental, 2008/10/10
#agg.path.chunksize : 0 # 0 to disable; values in the range
Expand Down