From: <lee...@us...> - 2008-12-07 20:40:17
|
Revision: 6503 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6503&view=rev Author: leejjoon Date: 2008-12-07 20:40:12 +0000 (Sun, 07 Dec 2008) Log Message: ----------- drop "new" keyword of np.histogram() for numpy 1.2 or later Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-06 23:17:10 UTC (rev 6502) +++ trunk/matplotlib/CHANGELOG 2008-12-07 20:40:12 UTC (rev 6503) @@ -1,3 +1,6 @@ +2008-12-07 drop the deprecated "new" keyword of np.histogram() for + numpy 1.2 or later. -JJL + 2008-12-06 Fixed a bug in svg backend that new_figure_manager() ignores keywords arguments such as figsize, etc. -JJL Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-06 23:17:10 UTC (rev 6502) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-07 20:40:12 UTC (rev 6503) @@ -6550,12 +6550,20 @@ # case do not autoscale axes. binsgiven = (cbook.iterable(bins) or range != None) + # check the version of the numpy + np_version = float(".".join(np.__version__.split(".")[:2])) + if np_version < 1.2: # version 1.1 + hist_kwargs = dict(range=range, + normed=bool(normed), new=True) + else: # version 1.2 and later, drop new=True + hist_kwargs = dict(range=range, + normed=bool(normed)) + n = [] for i in xrange(len(x)): # this will automatically overwrite bins, # so that each histogram uses the same bins - m, bins = np.histogram(x[i], bins, range=range, - normed=bool(normed), new=True) + m, bins = np.histogram(x[i], bins, **hist_kwargs) n.append(m) if cumulative: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |