Revision: 8267
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8267&view=rev
Author:   efiring
Date:     2010-04-22 08:27:18 +0000 (Thu, 22 Apr 2010)

Log Message:
-----------
Axes.hist: remove unnecessary copying of input array.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/axes.py

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py     2010-04-22 07:49:13 UTC (rev 
8266)
+++ trunk/matplotlib/lib/matplotlib/axes.py     2010-04-22 08:27:18 UTC (rev 
8267)
@@ -7289,17 +7289,16 @@
 
         if isinstance(x, np.ndarray):
             # TODO: support masked arrays;
-            #       Why is the copy needed?
-            x = np.array(x, copy=True, subok=False)
+            x = np.asarray(x)
             if x.ndim == 2:
-                x = x.T
+                x = x.T # 2-D input with columns as datasets; switch to rows
             elif x.ndim == 1:
-                x.shape = (1, x.shape[0])
+                x = x.reshape(1, x.shape[0])  # new view, single row
             else:
                 raise ValueError("x must be 1D or 2D")
             if x.shape[1] < x.shape[0]:
-                warnings.warn('2D hist input should be nsamples x nvariables; '
-                              'this looks transposed')
+                warnings.warn('2D hist input should be nsamples x 
nvariables;\n '
+                    '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]


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to