Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added 'capthick' kwarg to errorbar()

  • Loading branch information...
commit 19c20bee1deb5bad1865328c108509889a4fc2ae 1 parent 1ee7e7b
@WeatherGod authored
Showing with 28 additions and 8 deletions.
  1. +25 −6 lib/matplotlib/axes.py
  2. +3 −2 lib/matplotlib/pyplot.py
View
31 lib/matplotlib/axes.py
@@ -5179,14 +5179,16 @@ def pie(self, x, explode=None, labels=None, colors=None,
def errorbar(self, x, y, yerr=None, xerr=None,
fmt='-', ecolor=None, elinewidth=None, capsize=3,
barsabove=False, lolims=False, uplims=False,
- xlolims=False, xuplims=False, errorevery=1, **kwargs):
+ xlolims=False, xuplims=False, errorevery=1, capthick=None,
+ **kwargs):
"""
Call signature::
errorbar(x, y, yerr=None, xerr=None,
fmt='-', ecolor=None, elinewidth=None, capsize=3,
barsabove=False, lolims=False, uplims=False,
- xlolims=False, xuplims=False)
+ xlolims=False, xuplims=False, errorevery=1,
+ capthick=None)
Plot *x* versus *y* with error deltas in *yerr* and *xerr*.
Vertical errorbars are plotted if *yerr* is not *None*.
@@ -5210,14 +5212,22 @@ def errorbar(self, x, y, yerr=None, xerr=None,
errorbars to a bar plot, for example.
*ecolor*: [ *None* | mpl color ]
- a matplotlib color arg which gives the color the errorbar lines;
+ A matplotlib color arg which gives the color the errorbar lines;
if *None*, use the marker color.
*elinewidth*: scalar
- the linewidth of the errorbar lines. If *None*, use the linewidth.
+ The linewidth of the errorbar lines. If *None*, use the linewidth.
*capsize*: scalar
- the size of the error bar caps in points
+ The size of the error bar caps in points
+
+ *capthick*: scalar
+ An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This
+ setting is a more sensible name for the property that
+ controls the thickness of the error bar cap in points. For
+ backwards compatibility, if *mew* or *markeredgewidth* are given,
+ then they will over-ride *capthick*. This may change in future
+ releases.
*barsabove*: [ *True* | *False* ]
if *True*, will plot the errorbars above the plot
@@ -5268,7 +5278,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
"""
if errorevery < 1:
- raise ValueError('errorevery has to be a strictly positive integer ')
+ raise ValueError('errorevery has to be a strictly positive integer')
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
if not self._hold: self.cla()
@@ -5344,6 +5354,15 @@ def xywhere(xs, ys, mask):
plot_kw = {
'ms':2*capsize,
'label':'_nolegend_'}
+ if capthick is not None:
+ # 'mew' has higher priority, I believe,
+ # if both 'mew' and 'markeredgewidth' exists.
+ # So, save capthick to markeredgewidth so that
+ # explicitly setting mew or markeredgewidth will
+ # over-write capthick.
+ plot_kw['markeredgewidth'] = capthick
+ # For backwards-compat, allow explicit setting of
+ # 'mew' or 'markeredgewidth' to over-ride capthick.
if 'markeredgewidth' in kwargs:
plot_kw['markeredgewidth']=kwargs['markeredgewidth']
if 'mew' in kwargs:
View
5 lib/matplotlib/pyplot.py
@@ -2528,7 +2528,8 @@ def csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
@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,
- xlolims=False, xuplims=False, errorevery=1, hold=None, **kwargs):
+ xlolims=False, xuplims=False, errorevery=1, capthick=None,
+ hold=None, **kwargs):
ax = gca()
# allow callers to override the hold state by passing hold=True|False
washold = ax.ishold()
@@ -2540,7 +2541,7 @@ def errorbar(x, y, yerr=None, xerr=None, fmt='-', ecolor=None, elinewidth=None,
elinewidth=elinewidth, capsize=capsize,
barsabove=barsabove, lolims=lolims, uplims=uplims,
xlolims=xlolims, xuplims=xuplims,
- errorevery=errorevery, **kwargs)
+ errorevery=errorevery, capthick=capthick, **kwargs)
draw_if_interactive()
finally:
ax.hold(washold)
Please sign in to comment.
Something went wrong with that request. Please try again.