Skip to content

Commit 7b5280f

Browse files
committed
added support for mincnt to hexbin
svn path=/trunk/matplotlib/; revision=6699
1 parent ec83201 commit 7b5280f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/matplotlib/axes.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

release/osx/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ upload:
9595
rm -rf upload &&\
9696
mkdir upload &&\
9797
cp matplotlib-${MPLVERSION}.tar.gz upload/ &&\
98-
cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py2.5-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-py2.5.egg &&\
98+
cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py2.5-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-macosx-py2.5.egg &&\
9999
cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}-py2.5-macosx10.5.zip upload/matplotlib-${MPLVERSION}-py2.5-mpkg.zip&&\
100100
scp upload/* jdh2358@frs.sourceforge.net:uploads/
101101

0 commit comments

Comments
 (0)