Revision: 7740
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7740&view=rev
Author:   astraw
Date:     2009-09-11 01:54:27 +0000 (Fri, 11 Sep 2009)

Log Message:
-----------
bugfix: bounds checking in hexbin with extent specified (SF#2856228)

Modified Paths:
--------------
    branches/v0_99_maint/lib/matplotlib/axes.py

Modified: branches/v0_99_maint/lib/matplotlib/axes.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/axes.py 2009-09-11 01:52:47 UTC (rev 
7739)
+++ branches/v0_99_maint/lib/matplotlib/axes.py 2009-09-11 01:54:27 UTC (rev 
7740)
@@ -5624,9 +5624,13 @@
 
             for i in xrange(len(x)):
                 if bdist[i]:
-                    lattice1[ix1[i], iy1[i]]+=1
+                    if ((ix1[i] >= 0) and (ix1[i] < nx1) and
+                        (iy1[i] >= 0) and (iy1[i] < ny1)):
+                        lattice1[ix1[i], iy1[i]]+=1
                 else:
-                    lattice2[ix2[i], iy2[i]]+=1
+                    if ((ix2[i] >= 0) and (ix2[i] < nx2) and
+                        (iy2[i] >= 0) and (iy2[i] < ny2)):
+                        lattice2[ix2[i], iy2[i]]+=1
 
             # threshold
             if mincnt is not None:
@@ -5658,9 +5662,13 @@
 
             for i in xrange(len(x)):
                 if bdist[i]:
-                    lattice1[ix1[i], iy1[i]].append( C[i] )
+                    if ((ix1[i] >= 0) and (ix1[i] < nx1) and
+                        (iy1[i] >= 0) and (iy1[i] < ny1)):
+                        lattice1[ix1[i], iy1[i]].append( C[i] )
                 else:
-                    lattice2[ix2[i], iy2[i]].append( C[i] )
+                    if ((ix2[i] >= 0) and (ix2[i] < nx2) and
+                        (iy2[i] >= 0) and (iy2[i] < ny2)):
+                        lattice2[ix2[i], iy2[i]].append( C[i] )
 
 
             for i in xrange(nx1):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to