Revision: 5979
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5979&view=rev
Author:   mdboom
Date:     2008-08-06 12:50:31 +0000 (Wed, 06 Aug 2008)

Log Message:
-----------
Fix no-fill bug introduced in r5976

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/axes.py
    trunk/matplotlib/lib/matplotlib/collections.py
    trunk/matplotlib/lib/matplotlib/colors.py

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py     2008-08-06 00:28:03 UTC (rev 
5978)
+++ trunk/matplotlib/lib/matplotlib/axes.py     2008-08-06 12:50:31 UTC (rev 
5979)
@@ -5195,26 +5195,14 @@
             ymax = 10**ymax
             self.set_yscale('log')
 
-        class HexagonBinCollection(mcoll.PolyCollection):
-            """A HexagonBinCollection is a PolyCollection where the edge
-               colors are always kept equal to the fill colors"""
-            def update_scalarmappable(self):
-                mcoll.PolyCollection.update_scalarmappable(self)
-                self._edgecolors = self._facecolors
-
         if edgecolors=='none':
-            collection = HexagonBinCollection(
-                        polygons,
-                        linewidths = linewidths,
-                        transOffset = self.transData,
-                        )
-        else:
-            collection = mcoll.PolyCollection(
-                        polygons,
-                        edgecolors = edgecolors,
-                        linewidths = linewidths,
-                        transOffset = self.transData,
-                        )
+            edgecolors = 'face'
+        collection = mcoll.PolyCollection(
+            polygons,
+            edgecolors = edgecolors,
+            linewidths = linewidths,
+            transOffset = self.transData,
+            )
 
         # Transform accum if needed
         if bins=='log':

Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py      2008-08-06 00:28:03 UTC 
(rev 5978)
+++ trunk/matplotlib/lib/matplotlib/collections.py      2008-08-06 12:50:31 UTC 
(rev 5979)
@@ -8,7 +8,7 @@
 they are meant to be fast for common use cases (e.g. a bunch of solid
 line segemnts)
 """
-import math, warnings
+import copy, math, warnings
 import numpy as np
 import numpy.ma as ma
 import matplotlib as mpl
@@ -331,8 +331,8 @@
         ACCEPTS: matplotlib color arg or sequence of rgba tuples
         """
         if c is None: c = mpl.rcParams['patch.facecolor']
+        self._facecolors_original = c
         self._facecolors = _colors.colorConverter.to_rgba_array(c, self._alpha)
-        self._facecolors_original = c
 
     set_facecolors = set_facecolor
 
@@ -361,10 +361,11 @@
         """
         if c == 'face':
             self._edgecolors = 'face'
+            self._edgecolors_original = 'face'
         else:
             if c is None: c = mpl.rcParams['patch.edgecolor']
+            self._edgecolors_original = c
             self._edgecolors = _colors.colorConverter.to_rgba_array(c, 
self._alpha)
-            self._edgecolors_original = c
 
     set_edgecolors = set_edgecolor
 
@@ -385,8 +386,9 @@
             except (AttributeError, TypeError, IndexError):
                 pass
             try:
-                self._edgecolors = _colors.colorConverter.to_rgba_array(
-                    self._edgecolors_original, self._alpha)
+                if self._edgecolors_original != 'face':
+                    self._edgecolors = _colors.colorConverter.to_rgba_array(
+                        self._edgecolors_original, self._alpha)
             except (AttributeError, TypeError, IndexError):
                 pass
 
@@ -809,7 +811,7 @@
             pickradius=pickradius,
             **kwargs)
 
-        self._facecolors = np.array([])
+        self.set_facecolors([])
         self.set_segments(segments)
 
     def get_paths(self):

Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py   2008-08-06 00:28:03 UTC (rev 
5978)
+++ trunk/matplotlib/lib/matplotlib/colors.py   2008-08-06 12:50:31 UTC (rev 
5979)
@@ -332,7 +332,7 @@
         if len(c) == 0:
             return np.zeros((0,4), dtype=np.float_)
         try:
-            result = [self.to_rgba(c, alpha)]
+            result = np.array([self.to_rgba(c, alpha)], dtype=np.float_)
         except ValueError:
             # If c is a list it must be maintained as the same list
             # with modified items so that items can be appended to
@@ -340,18 +340,10 @@
             if isinstance(c, np.ndarray):
                 if len(c.shape) != 2:
                     raise ValueError("Color array must be two-dimensional")
-                if c.shape[1] != 4:
-                    output = np.zeros((c.shape[0], 4))
-                else:
-                    output = c
-            elif not isinstance(c, list):
-                output = list(c)
-            else:
-                output = c
 
+            result = np.zeros((len(c), 4))
             for i, cc in enumerate(c):
-                output[i] = self.to_rgba(cc, alpha)  # change in place
-            result = output
+                result[i] = self.to_rgba(cc, alpha)  # change in place
         return np.asarray(result, np.float_)
 
 colorConverter = ColorConverter()


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to