Skip to content

Commit 8b278ab

Browse files
committed
Added range keyword arg to hist()
svn path=/trunk/matplotlib/; revision=5430
1 parent ae11003 commit 8b278ab

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
2008=06-07 Moved list of backends to rcsetup.py; made use of lower
1+
2008-06-09 Added range keyword arg to hist() - MM
2+
3+
2008-06-07 Moved list of backends to rcsetup.py; made use of lower
24
case for backend names consistent; use validate_backend
35
when importing backends subpackage - EF
46

lib/matplotlib/axes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5649,7 +5649,7 @@ def twiny(self):
56495649

56505650
#### Data analysis
56515651

5652-
def hist(self, x, bins=10, normed=False, cumulative=False,
5652+
def hist(self, x, bins=10, range=None, normed=False, cumulative=False,
56535653
bottom=None, histtype='bar', align='mid',
56545654
orientation='vertical', rwidth=None, log=False, **kwargs):
56555655
"""
@@ -5669,6 +5669,10 @@ def hist(self, x, bins=10, normed=False, cumulative=False,
56695669
either an integer number of bins or a sequence giving the
56705670
bins. x are the data to be binned. x can be an array or a 2D
56715671
array with multiple data in its columns.
5672+
5673+
range:
5674+
The lower and upper range of the bins. Lower and upper outliers
5675+
are ignored. If not provided, range is (x.min(), x.max()).
56725676
56735677
normed:
56745678
if True, the first element of the return tuple will
@@ -5742,11 +5746,11 @@ def hist(self, x, bins=10, normed=False, cumulative=False,
57425746
for i in xrange(x.shape[1]):
57435747
# this will automatically overwrite bins,
57445748
# so that each histogram uses the same bins
5745-
m, bins = np.histogram(x[:,i], bins, range=None,
5749+
m, bins = np.histogram(x[:,i], bins, range=range,
57465750
normed=bool(normed), new=True)
57475751
n.append(m)
57485752
else:
5749-
n, bins = np.histogram(x, bins, range=None,
5753+
n, bins = np.histogram(x, bins, range=range,
57505754
normed=bool(normed), new=True)
57515755
n = [n,]
57525756

0 commit comments

Comments
 (0)