Revision: 4877
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4877&view=rev
Author:   mdboom
Date:     2008-01-18 09:27:35 -0800 (Fri, 18 Jan 2008)

Log Message:
-----------
Fix lasso_demo.py

Modified Paths:
--------------
    trunk/matplotlib/examples/lasso_demo.py
    trunk/matplotlib/lib/matplotlib/collections.py

Modified: trunk/matplotlib/examples/lasso_demo.py
===================================================================
--- trunk/matplotlib/examples/lasso_demo.py     2008-01-18 15:04:52 UTC (rev 
4876)
+++ trunk/matplotlib/examples/lasso_demo.py     2008-01-18 17:27:35 UTC (rev 
4877)
@@ -35,12 +35,12 @@
 
         self.Nxy = len(data)
 
-        self.facecolors = [d.color for d in data]
+        facecolors = [d.color for d in data]
         self.xys = [(d.x, d.y) for d in data]
 
         self.collection = RegularPolyCollection(
             fig.dpi, 6, sizes=(100,),
-            facecolors=self.facecolors,
+            facecolors=facecolors,
             offsets = self.xys,
             transOffset = ax.transData)
 
@@ -49,12 +49,13 @@
         self.cid = self.canvas.mpl_connect('button_press_event', self.onpress)
 
     def callback(self, verts):
+        facecolors = self.collection.get_facecolors()
         ind = nonzero(points_inside_poly(self.xys, verts))[0]
         for i in range(self.Nxy):
             if i in ind:
-                self.facecolors[i] = Datum.colorin
+                facecolors[i] = Datum.colorin
             else:
-                self.facecolors[i] = Datum.colorout
+                facecolors[i] = Datum.colorout
 
         self.canvas.draw_idle()
         self.canvas.widgetlock.release(self.lasso)

Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py      2008-01-18 15:04:52 UTC 
(rev 4876)
+++ trunk/matplotlib/lib/matplotlib/collections.py      2008-01-18 17:27:35 UTC 
(rev 4877)
@@ -275,6 +275,10 @@
 
     set_facecolors = set_facecolor
 
+    def get_facecolor(self):
+        return self._facecolors
+    get_facecolors = get_facecolor
+
     def set_edgecolor(self, c):
         """
         Set the edgecolor(s) of the collection. c can be a matplotlib color


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to