From: <ef...@us...> - 2008-12-15 06:26:29
|
Revision: 6607 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6607&view=rev Author: efiring Date: 2008-12-15 06:26:18 +0000 (Mon, 15 Dec 2008) Log Message: ----------- In collections, keep track of whether edges or faces are colormapped. Thanks to Eric Bruning for finding the problem and outlining the solution. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008-12-15 06:23:25 UTC (rev 6606) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008-12-15 06:26:18 UTC (rev 6607) @@ -231,7 +231,7 @@ def get_pickradius(self): return self.pickradius def set_urls(self, urls): - if urls is None: + if urls is None: self._urls = [None,] else: self._urls = urls @@ -365,11 +365,19 @@ """ Set the facecolor(s) of the collection. *c* can be a matplotlib color arg (all patches have same color), or a - sequence or rgba tuples; if it is a sequence the patches will - cycle through the sequence + sequence of rgba tuples; if it is a sequence the patches will + cycle through the sequence. + If *c* is 'none', the patch will not be filled. + ACCEPTS: matplotlib color arg or sequence of rgba tuples """ + self._is_filled = True + try: + if c.lower() == 'none': + self._is_filled = False + except AttributeError: + pass if c is None: c = mpl.rcParams['patch.facecolor'] self._facecolors_original = c self._facecolors = _colors.colorConverter.to_rgba_array(c, self._alpha) @@ -393,14 +401,21 @@ """ Set the edgecolor(s) of the collection. *c* can be a matplotlib color arg (all patches have same color), or a - sequence or rgba tuples; if it is a sequence the patches will + sequence of rgba tuples; if it is a sequence the patches will cycle through the sequence. If *c* is 'face', the edge color will always be the same as - the face color. + the face color. If it is 'none', the patch boundary will not + be drawn. ACCEPTS: matplotlib color arg or sequence of rgba tuples """ + self._is_stroked = True + try: + if c.lower() == 'none': + self._is_stroked = False + except AttributeError: + pass if c == 'face': self._edgecolors = 'face' self._edgecolors_original = 'face' @@ -409,6 +424,7 @@ self._edgecolors_original = c self._edgecolors = _colors.colorConverter.to_rgba_array(c, self._alpha) + def set_edgecolors(self, c): """alias for set_edgecolor""" return self.set_edgecolor(c) @@ -452,9 +468,9 @@ if self._A is None: return if self._A.ndim > 1: raise ValueError('Collections can only map rank 1 arrays') - if len(self._facecolors): + if self._is_filled: self._facecolors = self.to_rgba(self._A, self._alpha) - else: + elif self._is_stroked: self._edgecolors = self.to_rgba(self._A, self._alpha) def update_from(self, other): @@ -887,6 +903,7 @@ Collection.__init__( self, edgecolors=colors, + facecolors='none', linewidths=linewidths, linestyles=linestyles, antialiaseds=antialiaseds, @@ -897,7 +914,6 @@ pickradius=pickradius, **kwargs) - self.set_facecolors([]) self.set_segments(segments) def get_paths(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |