I noticed that Axes.errorbar() was being unnecessarily called by Axes.bar(), due to improper handling of when xerr and yerr are passed as None (the default). I don't think it was causing any bad behaviour, but here's the patch nevertheless.

Cheers,

Martin
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py      (revision 2528)
+++ lib/matplotlib/axes.py      (working copy)
@@ -2477,14 +2477,16 @@
             not iterable(edgecolor)):
             edgecolor = [edgecolor]*nbars
 
-        if not iterable(yerr):
-            yerr = asarray([yerr]*nbars, Float) # Float converts Nones to NANs
-        else:
-            yerr = asarray(yerr)
-        if not iterable(xerr):
-            xerr = asarray([xerr]*nbars, Float)
-        else:
-            xerr = asarray(xerr)
+        if yerr is not None:
+            if not iterable(yerr):
+                yerr = asarray([yerr]*nbars)
+            else:
+                yerr = asarray(yerr)
+        if xerr is not None:
+            if not iterable(xerr):
+                xerr = asarray([xerr]*nbars)
+            else:
+                xerr = asarray(xerr)
 
         if orientation == 'vertical':
             lenarg = 'left'
@@ -2496,8 +2498,10 @@
         assert len(bottom)==nbars, 'bar() argument \'bottom\' must be len(%s) 
or scalar' % lenarg
         assert len(color)==nbars, 'bar() argument \'color\' must be len(%s) or 
scalar' % lenarg
         assert len(edgecolor)==nbars, 'bar() argument \'edgecolor\' must be 
len(%s) or scalar' % lenarg
-        assert len(yerr)==nbars, 'bar() argument \'yerr\' must be len(%s) or 
scalar' % lenarg
-        assert len(xerr)==nbars, 'bar() argument \'xerr\' must be len(%s) or 
scalar' % lenarg
+        if yerr is not None:
+            assert len(yerr)==nbars, 'bar() argument \'yerr\' must be len(%s) 
or scalar' % lenarg
+        if xerr is not None:
+            assert len(xerr)==nbars, 'bar() argument \'xerr\' must be len(%s) 
or scalar' % lenarg
 
         patches = []
 
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to