Revision: 6779
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6779&view=rev
Author:   jdh2358
Date:     2009-01-12 12:22:11 +0000 (Mon, 12 Jan 2009)

Log Message:
-----------
Added TJ's hexbin mincnt patch; made marginals False by default

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

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py     2009-01-12 09:04:57 UTC (rev 
6778)
+++ trunk/matplotlib/lib/matplotlib/axes.py     2009-01-12 12:22:11 UTC (rev 
6779)
@@ -5219,7 +5219,7 @@
                     xscale = 'linear', yscale = 'linear',
                     cmap=None, norm=None, vmin=None, vmax=None,
                     alpha=1.0, linewidths=None, edgecolors='none',
-                    reduce_C_function = np.mean, mincnt=None, marginals=True,
+                    reduce_C_function = np.mean, mincnt=None, marginals=False,
                     **kwargs):
         """
         call signature::
@@ -5395,9 +5395,6 @@
         d1 = (x-ix1)**2 + 3.0 * (y-iy1)**2
         d2 = (x-ix2-0.5)**2 + 3.0 * (y-iy2-0.5)**2
         bdist = (d1<d2)
-        if mincnt is None:
-            mincnt = 0
-
         if C is None:
             accum = np.zeros(n)
             # Create appropriate views into "accum" array.
@@ -5411,7 +5408,25 @@
                     lattice1[ix1[i], iy1[i]]+=1
                 else:
                     lattice2[ix2[i], iy2[i]]+=1
+
+            # threshold
+            if mincnt is not None:
+                for i in xrange(nx1):
+                    for j in xrange(ny1):
+                        if lattice1[i,j]<mincnt:
+                            lattice1[i,j] = np.nan
+                for i in xrange(nx2):
+                    for j in xrange(ny2):
+                        if lattice2[i,j]<mincnt:
+                            lattice2[i,j] = np.nan
+            accum = np.hstack((
+                lattice1.astype(float).ravel(), 
lattice2.astype(float).ravel()))
+            good_idxs = ~np.isnan(accum)
+
         else:
+            if mincnt is None:
+                mincnt = 0
+
             # create accumulation arrays
             lattice1 = np.empty((nx1,ny1),dtype=object)
             for i in xrange(nx1):
@@ -5457,10 +5472,9 @@
         polygons[:,nx1*ny1:,0] = np.repeat(np.arange(nx2) + 0.5, ny2)
         polygons[:,nx1*ny1:,1] = np.tile(np.arange(ny2), nx2) + 0.5
 
-        if C is not None:
-            # remove accumulation bins with no data
-            polygons = polygons[:,good_idxs,:]
-            accum = accum[good_idxs]
+        # remove accumulation bins with no data
+        polygons = polygons[:,good_idxs,:]
+        accum = accum[good_idxs]
 
         polygons = np.transpose(polygons, axes=[1,0,2])
         polygons[:,:,0] *= sx


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

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to