From: <md...@us...> - 2007-11-15 17:17:18
|
Revision: 4309 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4309&view=rev Author: mdboom Date: 2007-11-15 09:17:02 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Bugfixes (getting some examples to work again). Modified Paths: -------------- branches/transforms/examples/scatter_star_poly.py branches/transforms/lib/matplotlib/path.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/examples/scatter_star_poly.py =================================================================== --- branches/transforms/examples/scatter_star_poly.py 2007-11-15 17:08:39 UTC (rev 4308) +++ branches/transforms/examples/scatter_star_poly.py 2007-11-15 17:17:02 UTC (rev 4309) @@ -9,7 +9,7 @@ pylab.subplot(322) pylab.scatter(x,y,s=80,marker=(5,0)) -verts = zip([-1.,1.,1.],[-1.,-1.,1.]) +verts = zip([-1.,1.,1.,-1.],[-1.,-1.,1.,-1.]) pylab.subplot(323) pylab.scatter(x,y,s=80,marker=(verts,0)) # equivalent: Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007-11-15 17:08:39 UTC (rev 4308) +++ branches/transforms/lib/matplotlib/path.py 2007-11-15 17:17:02 UTC (rev 4309) @@ -112,11 +112,11 @@ # MOVETO commands to the codes array accordingly. if mask is not ma.nomask: mask1d = ma.mask_or(mask[:, 0], mask[:, 1]) - vertices = ma.compress(npy.invert(mask1d), vertices, 0) if codes is None: codes = self.LINETO * npy.ones( - vertices.shape[0], self.code_type) + len(vertices), self.code_type) codes[0] = self.MOVETO + vertices = ma.compress(npy.invert(mask1d), vertices, 0) codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])), self.MOVETO, codes) codes = ma.masked_array(codes, mask=mask1d).compressed() @@ -273,7 +273,7 @@ path = cls._unit_regular_polygons.get(numVertices) if path is None: theta = (2*npy.pi/numVertices * - npy.arange(numVertices).reshape((numVertices, 1))) + npy.arange(numVertices + 1).reshape((numVertices + 1, 1))) # This initial rotation is to make sure the polygon always # "points-up" theta += npy.pi / 2.0 @@ -293,11 +293,11 @@ path = cls._unit_regular_stars.get((numVertices, innerCircle)) if path is None: ns2 = numVertices * 2 - theta = (2*npy.pi/ns2 * npy.arange(ns2)) + theta = (2*npy.pi/ns2 * npy.arange(ns2 + 1)) # This initial rotation is to make sure the polygon always # "points-up" theta += npy.pi / 2.0 - r = npy.ones(ns2) + r = npy.ones(ns2 + 1) r[1::2] = innerCircle verts = npy.vstack((r*npy.cos(theta), r*npy.sin(theta))).transpose() path = Path(verts) Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-11-15 17:08:39 UTC (rev 4308) +++ branches/transforms/src/_backend_agg.cpp 2007-11-15 17:17:02 UTC (rev 4309) @@ -1044,21 +1044,22 @@ class PathListGenerator { const Py::SeqBase<Py::Object>& m_paths; + size_t m_npaths; public: typedef PathIterator path_iterator; inline PathListGenerator(const Py::SeqBase<Py::Object>& paths) : - m_paths(paths) { + m_paths(paths), m_npaths(paths.size()) { } inline size_t num_paths() const { - return m_paths.size(); + return m_npaths; } inline path_iterator operator()(size_t i) const { - return PathIterator(m_paths[i]); + return PathIterator(m_paths[i % m_npaths]); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |