From: <md...@us...> - 2008-06-20 15:03:20
|
Revision: 5615 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5615&view=rev Author: mdboom Date: 2008-06-20 08:03:18 -0700 (Fri, 20 Jun 2008) Log Message: ----------- Fix bug: [ 1994535 ] still missing lines on graph with svn (r 5548). Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-06-20 14:47:17 UTC (rev 5614) +++ trunk/matplotlib/CHANGELOG 2008-06-20 15:03:18 UTC (rev 5615) @@ -1,3 +1,6 @@ +2008-06-20 Added closed kwarg to PolyCollection. Fixes bug [ 1994535 + ] still missing lines on graph with svn (r 5548). - MGD + 2008-06-20 Added set/get_closed method to Polygon; fixes error in hist - MM Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008-06-20 14:47:17 UTC (rev 5614) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008-06-20 15:03:18 UTC (rev 5615) @@ -514,7 +514,7 @@ renderer.close_group(self.__class__.__name__) class PolyCollection(Collection): - def __init__(self, verts, sizes = None, **kwargs): + def __init__(self, verts, sizes = None, closed = True, **kwargs): """ *verts* is a sequence of ( *verts0*, *verts1*, ...) where *verts_i* is a sequence of *xy* tuples of vertices, or an @@ -523,16 +523,26 @@ *sizes* gives the area of the circle circumscribing the polygon in points^2. + *closed*, when *True*, will explicitly close the polygon. + %(Collection)s """ Collection.__init__(self,**kwargs) self._sizes = sizes - self.set_verts(verts) + self.set_verts(verts, closed) __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd - def set_verts(self, verts): + def set_verts(self, verts, closed=True): '''This allows one to delay initialization of the vertices.''' - self._paths = [mpath.Path(v) for v in verts] + if closed: + self._paths = [] + for xy in verts: + xy = np.asarray(xy) + if len(xy) and (xy[0] != xy[-1]).any(): + xy = np.concatenate([xy, [xy[0]]]) + self._paths.append(mpath.Path(xy)) + else: + self._paths = [mpath.Path(xy) for xy in verts] def get_paths(self): return self._paths This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |