It looks like mincnt is used only when C is not None. For the default
histogram method, I've found it useful to be able to turn off cells
with fewer then *mincnt* points. Attached is a diff which implements
this. Also, should *marginals* be True by default? It seems that
hexbin is an alternative to scatter and since scatter doesn't have it,
then hexbin should not have it either.
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py (revision 6777)
+++ lib/matplotlib/axes.py (working copy)
@@ -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
------------------------------------------------------------------------------
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel