diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 8c7f0205de7d..56c99d9b3ec1 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4273,13 +4273,18 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, lattice1 = np.zeros((nx1, ny1)) lattice2 = np.zeros((nx2, ny2)) - for i in xrange(len(x)): - if bdist[i]: - if 0 <= ix1[i] < nx1 and 0 <= iy1[i] < ny1: - lattice1[ix1[i], iy1[i]] += 1 - else: - if 0 <= ix2[i] < nx2 and 0 <= iy2[i] < ny2: - lattice2[ix2[i], iy2[i]] += 1 + cond1 = (0 <= ix1) * (ix1 < nx1) * (0 <= iy1) * (iy1 < ny1) + cond2 = (0 <= ix2) * (ix2 < nx2) * (0 <= iy2) * (iy2 < ny2) + + cond1 *= bdist + cond2 *= np.logical_not(bdist) + ix1, iy1 = ix1[cond1], iy1[cond1] + ix2, iy2 = ix2[cond2], iy2[cond2] + + for ix, iy in zip(ix1, iy1): + lattice1[ix, iy] += 1 + for ix, iy in zip(ix2, iy2): + lattice2[ix, iy] += 1 # threshold if mincnt is not None: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy