Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e986cc7

Browse files
committed
hist: accept a list of scalars as equivalent to a 1-D ndarray
svn path=/trunk/matplotlib/; revision=8293
1 parent 52cb510 commit e986cc7

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6187,7 +6187,7 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
61876187
precise point of intersection. Otherwise, the start and
61886188
end points of the filled region will only occur on explicit
61896189
values in the *x* array.
6190-
6190+
61916191
*kwargs*
61926192
keyword args passed on to the :class:`PolyCollection`
61936193
@@ -6254,13 +6254,13 @@ def get_interp_point(ind):
62546254
return x[ind-1], y1[ind-1]
62556255
elif np.ma.is_masked(diff_values[0]):
62566256
return x[ind], y1[ind]
6257-
6257+
62586258
diff_order = diff_values.argsort()
62596259
diff_root_x = np.interp(
62606260
0, diff_values[diff_order], x_values[diff_order])
62616261
diff_root_y = np.interp(diff_root_x, x_values, y1_values)
62626262
return diff_root_x, diff_root_y
6263-
6263+
62646264
start = get_interp_point(ind0)
62656265
end = get_interp_point(ind1)
62666266
else:
@@ -6272,12 +6272,12 @@ def get_interp_point(ind):
62726272

62736273
X[0] = start
62746274
X[N+1] = end
6275-
6275+
62766276
X[1:N+1,0] = xslice
62776277
X[1:N+1,1] = y1slice
62786278
X[N+2:,0] = xslice[::-1]
62796279
X[N+2:,1] = y2slice[::-1]
6280-
6280+
62816281
polys.append(X)
62826282

62836283
collection = mcoll.PolyCollection(polys, **kwargs)
@@ -7328,7 +7328,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
73287328
'hist now uses the rwidth to give relative width '
73297329
'and not absolute width')
73307330

7331-
if isinstance(x, np.ndarray):
7331+
if isinstance(x, np.ndarray) or not iterable(x[0]):
73327332
# TODO: support masked arrays;
73337333
x = np.asarray(x)
73347334
if x.ndim == 2:

0 commit comments

Comments
 (0)