Skip to content

Commit 7ceb74c

Browse files
committed
Merged revisions 8595 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint ........ r8595 | weathergod | 2010-07-29 16:55:52 -0500 (Thu, 29 Jul 2010) | 2 lines Fix inconsistency with the handling of the 'weights' keyword and input data for hist(). ........ svn path=/trunk/matplotlib/; revision=8596
1 parent 0d79d80 commit 7ceb74c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/axes.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -7551,6 +7551,8 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
75517551
'hist now uses the rwidth to give relative width '
75527552
'and not absolute width')
75537553

7554+
# Massage 'x' for processing.
7555+
# NOTE: Be sure any changes here is also done below to 'weights'
75547556
if isinstance(x, np.ndarray) or not iterable(x[0]):
75557557
# TODO: support masked arrays;
75567558
x = np.asarray(x)
@@ -7577,8 +7579,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
75777579
if len(color) != nx:
75787580
raise ValueError("color kwarg must have one color per dataset")
75797581

7582+
# We need to do to 'weights' what was done to 'x'
75807583
if weights is not None:
7581-
if isinstance(weights, np.ndarray):
7584+
if isinstance(weights, np.ndarray) or not iterable(weights[0]) :
75827585
w = np.array(weights)
75837586
if w.ndim == 2:
75847587
w = w.T

0 commit comments

Comments
 (0)