From: <jd...@us...> - 2008-05-23 23:18:02
|
Revision: 5248 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5248&view=rev Author: jdh2358 Date: 2008-05-23 16:17:57 -0700 (Fri, 23 May 2008) Log Message: ----------- fixed a hist bug with 1xN inputs Modified Paths: -------------- trunk/matplotlib/examples/pylab/mri_with_eeg.py trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/examples/pylab/mri_with_eeg.py =================================================================== --- trunk/matplotlib/examples/pylab/mri_with_eeg.py 2008-05-23 21:53:33 UTC (rev 5247) +++ trunk/matplotlib/examples/pylab/mri_with_eeg.py 2008-05-23 23:17:57 UTC (rev 5248) @@ -27,6 +27,7 @@ im = take(im, nonzero(im)) # ignore the background im = im/(2.0**15) # normalize hist(im, 100) + print im.shape xticks([-1, -.5, 0, .5, 1]) yticks([]) xlabel('intensity') @@ -84,6 +85,7 @@ xlabel('time (s)') +if 1: + savefig('mri_with_eeg') -#savefig('mri_with_eeg') show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-23 21:53:33 UTC (rev 5247) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-23 23:17:57 UTC (rev 5248) @@ -5484,8 +5484,15 @@ 'hist now uses the rwidth to give relative width and not absolute width') # todo: make hist() work with list of arrays with different lengths - x = np.asarray(x) + x = np.asarray(x).copy() + if len(x.shape)==2 and min(x.shape)==1: + x.shape = max(x.shape), + + if len(x.shape)==2 and x.shape[0]<x.shape[1]: + warnings.warn('2D hist should be nsamples x nvariables; this looks transposed') + if len(x.shape)==2: + n = [] for i in xrange(x.shape[1]): # this will automatically overwrite bins, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |