@@ -5212,7 +5212,7 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
5212
5212
xscale = 'linear' , yscale = 'linear' ,
5213
5213
cmap = None , norm = None , vmin = None , vmax = None ,
5214
5214
alpha = 1.0 , linewidths = None , edgecolors = 'none' ,
5215
- reduce_C_function = np .mean ,
5215
+ reduce_C_function = np .mean , mincnt = None ,
5216
5216
** kwargs ):
5217
5217
"""
5218
5218
call signature::
@@ -5221,7 +5221,7 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
5221
5221
xscale = 'linear', yscale = 'linear',
5222
5222
cmap=None, norm=None, vmin=None, vmax=None,
5223
5223
alpha=1.0, linewidths=None, edgecolors='none'
5224
- reduce_C_function = np.mean,
5224
+ reduce_C_function = np.mean, mincnt=None,
5225
5225
**kwargs)
5226
5226
5227
5227
Make a hexagonal binning plot of *x* versus *y*, where *x*,
@@ -5269,6 +5269,10 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
5269
5269
*scale*: [ 'linear' | 'log' ]
5270
5270
Use a linear or log10 scale on the vertical axis.
5271
5271
5272
+ *mincnt*: None | a positive integer
5273
+ If not None, only display cells with at least *mincnt*
5274
+ number of points in the cell
5275
+
5272
5276
Other keyword arguments controlling color mapping and normalization
5273
5277
arguments:
5274
5278
@@ -5369,6 +5373,8 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
5369
5373
d1 = (x - ix1 )** 2 + 3.0 * (y - iy1 )** 2
5370
5374
d2 = (x - ix2 - 0.5 )** 2 + 3.0 * (y - iy2 - 0.5 )** 2
5371
5375
bdist = (d1 < d2 )
5376
+ if mincnt is None :
5377
+ mincnt = 0
5372
5378
5373
5379
if C is None :
5374
5380
accum = np .zeros (n )
@@ -5400,10 +5406,11 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
5400
5406
else :
5401
5407
lattice2 [ix2 [i ], iy2 [i ]].append ( C [i ] )
5402
5408
5409
+
5403
5410
for i in xrange (nx1 ):
5404
5411
for j in xrange (ny1 ):
5405
5412
vals = lattice1 [i ,j ]
5406
- if len (vals ):
5413
+ if len (vals )> mincnt :
5407
5414
lattice1 [i ,j ] = reduce_C_function ( vals )
5408
5415
else :
5409
5416
lattice1 [i ,j ] = np .nan
0 commit comments