From: <jd...@us...> - 2010-07-31 18:20:37
|
Revision: 8607 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8607&view=rev Author: jdh2358 Date: 2010-07-31 18:20:30 +0000 (Sat, 31 Jul 2010) Log Message: ----------- use asarray in hist Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py 2010-07-31 09:18:25 UTC (rev 8606) +++ trunk/matplotlib/examples/pylab_examples/agg_buffer_to_array.py 2010-07-31 18:20:30 UTC (rev 8607) @@ -1,5 +1,5 @@ import matplotlib -matplotlib.use('Agg') +#matplotlib.use('Agg') from pylab import figure, show import numpy as np Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-07-31 09:18:25 UTC (rev 8606) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-07-31 18:20:30 UTC (rev 8607) @@ -7401,11 +7401,13 @@ **kwargs): """ call signature:: + + def hist(x, bins=10, range=None, normed=False, weights=None, + cumulative=False, bottom=None, histtype='bar', align='mid', + orientation='vertical', rwidth=None, log=False, + color=None, label=None, + **kwargs): - hist(x, bins=10, range=None, normed=False, cumulative=False, - bottom=None, histtype='bar', align='mid', - orientation='vertical', rwidth=None, log=False, **kwargs) - Compute and draw the histogram of *x*. The return value is a tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, [*patches0*, *patches1*,...]) if the input contains multiple @@ -7567,7 +7569,7 @@ 'this looks transposed (shape is %d x %d)' % x.shape[::-1]) else: # multiple hist with data of different length - x = [np.array(xi) for xi in x] + x = [np.asarray(xi) for xi in x] nx = len(x) # number of datasets @@ -7582,7 +7584,7 @@ # We need to do to 'weights' what was done to 'x' if weights is not None: if isinstance(weights, np.ndarray) or not iterable(weights[0]) : - w = np.array(weights) + w = np.asarray(weights) if w.ndim == 2: w = w.T elif w.ndim == 1: @@ -7590,7 +7592,7 @@ else: raise ValueError("weights must be 1D or 2D") else: - w = [np.array(wi) for wi in weights] + w = [np.asarray(wi) for wi in weights] if len(w) != nx: raise ValueError('weights should have the same shape as x') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |