@@ -5212,7 +5212,7 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
52125212 xscale = 'linear' , yscale = 'linear' ,
52135213 cmap = None , norm = None , vmin = None , vmax = None ,
52145214 alpha = 1.0 , linewidths = None , edgecolors = 'none' ,
5215- reduce_C_function = np .mean ,
5215+ reduce_C_function = np .mean , mincnt = None ,
52165216 ** kwargs ):
52175217 """
52185218 call signature::
@@ -5221,7 +5221,7 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
52215221 xscale = 'linear', yscale = 'linear',
52225222 cmap=None, norm=None, vmin=None, vmax=None,
52235223 alpha=1.0, linewidths=None, edgecolors='none'
5224- reduce_C_function = np.mean,
5224+ reduce_C_function = np.mean, mincnt=None,
52255225 **kwargs)
52265226
52275227 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,
52695269 *scale*: [ 'linear' | 'log' ]
52705270 Use a linear or log10 scale on the vertical axis.
52715271
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+
52725276 Other keyword arguments controlling color mapping and normalization
52735277 arguments:
52745278
@@ -5369,6 +5373,8 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
53695373 d1 = (x - ix1 )** 2 + 3.0 * (y - iy1 )** 2
53705374 d2 = (x - ix2 - 0.5 )** 2 + 3.0 * (y - iy2 - 0.5 )** 2
53715375 bdist = (d1 < d2 )
5376+ if mincnt is None :
5377+ mincnt = 0
53725378
53735379 if C is None :
53745380 accum = np .zeros (n )
@@ -5400,10 +5406,11 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
54005406 else :
54015407 lattice2 [ix2 [i ], iy2 [i ]].append ( C [i ] )
54025408
5409+
54035410 for i in xrange (nx1 ):
54045411 for j in xrange (ny1 ):
54055412 vals = lattice1 [i ,j ]
5406- if len (vals ):
5413+ if len (vals )> mincnt :
54075414 lattice1 [i ,j ] = reduce_C_function ( vals )
54085415 else :
54095416 lattice1 [i ,j ] = np .nan
0 commit comments