|
From: <ef...@us...> - 2010-06-01 03:11:45
|
Revision: 8360
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8360&view=rev
Author: efiring
Date: 2010-06-01 03:11:39 +0000 (Tue, 01 Jun 2010)
Log Message:
-----------
Axes.bar: let errorbar take care of most checking and processing of xerr, yerr.
Closes 2804500.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2010-06-01 02:36:47 UTC (rev 8359)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2010-06-01 03:11:39 UTC (rev 8360)
@@ -4306,6 +4306,9 @@
*xerr*, and *yerr* can be either scalars or sequences of
length equal to the number of bars. This enables you to use
bar as the basis for stacked bar charts, or candlestick plots.
+ Detail: *xerr* and *yerr* are passed directly to
+ :meth:`errorbar`, so they can also have shape 2xN for
+ independent specification of lower and upper errors.
Other optional kwargs:
@@ -4319,6 +4322,9 @@
color = kwargs.pop('color', None)
edgecolor = kwargs.pop('edgecolor', None)
linewidth = kwargs.pop('linewidth', None)
+ # Because xerr and yerr will be passed to errorbar,
+ # most dimension checking and processing will be left
+ # to the errorbar method.
xerr = kwargs.pop('xerr', None)
yerr = kwargs.pop('yerr', None)
ecolor = kwargs.pop('ecolor', None)
@@ -4396,14 +4402,6 @@
if len(edgecolor) < nbars:
edgecolor *= nbars
- if yerr is not None:
- if not iterable(yerr):
- yerr = [yerr]*nbars
-
- if xerr is not None:
- if not iterable(xerr):
- xerr = [xerr]*nbars
-
# FIXME: convert the following to proper input validation
# raising ValueError; don't use assert for this.
assert len(left)==nbars, "incompatible sizes: argument 'left' must be length %d or scalar" % nbars
@@ -4414,13 +4412,6 @@
assert len(bottom)==nbars, ("incompatible sizes: argument 'bottom' must be length %d or scalar" %
nbars)
- if yerr is not None and len(yerr)!=nbars:
- raise ValueError(
- "incompatible sizes: bar() argument 'yerr' must be len(%s) or scalar" % nbars)
- if xerr is not None and len(xerr)!=nbars:
- raise ValueError(
- "incompatible sizes: bar() argument 'xerr' must be len(%s) or scalar" % nbars)
-
patches = []
# lets do some conversions now since some types cannot be
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|