Skip to content

Commit 949d657

Browse files
committed
Speed up for loop in hexbin
1 parent 932d83d commit 949d657

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/axes/_axes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4281,10 +4281,10 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
42814281
ix1, iy1 = ix1[cond1], iy1[cond1]
42824282
ix2, iy2 = ix2[cond2], iy2[cond2]
42834283

4284-
for i in xrange(ix1.size):
4285-
lattice1[ix1[i], iy1[i]] += 1
4286-
for i in xrange(ix2.size):
4287-
lattice2[ix2[i], iy2[i]] += 1
4284+
for ix, iy in zip(ix1, iy1):
4285+
lattice1[ix, iy] += 1
4286+
for ix, iy in zip(ix2, iy2):
4287+
lattice2[ix, iy] += 1
42884288

42894289
# threshold
42904290
if mincnt is not None:

0 commit comments

Comments
 (0)