Hello,

The documentation for hist seems to indicate that you should be able
to send a list of values through the 'weights' parameter in axes.hist,
and this worked in previous versions.  In 1.0, however, this produces
an error.  I've attached a diff (also pasted below) that I believe
produces the expected behavior.

It can be tested with:
plt.hist([1,2,3], weights=[1,2,3])

The above fails in the development version, but works with the diff.
Could someone add this fix?

Thanks,
Jeff

|| Jeff Klukas, Research Assistant, Physics
|| University of Wisconsin -- Madison
|| jeff.klu...@gmail | jeffyklu...@aim | jeffklu...@skype
|| http://klukas.web.cern.ch/


Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py      (revision 8565)
+++ lib/matplotlib/axes.py      (working copy)
@@ -7587,7 +7587,12 @@
                 else:
                     raise ValueError("weights must be 1D or 2D")
             else:
-                w = [np.array(wi) for wi in weights]
+                try:
+                    weights[0][0]
+                except TypeError:
+                    w = [np.array(weights)]
+                else:
+                    w = [np.array(wi) for wi in weights]

             if len(w) != nx:
                 raise ValueError('weights should have the same shape as x')

Attachment: weights.diff
Description: Binary data

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to