From: <ef...@us...> - 2009-08-05 00:05:49
|
Revision: 7356 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7356&view=rev Author: efiring Date: 2009-08-05 00:05:37 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Elimination of contourf cut strokes: second try Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/src/cntr.c Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-08-04 19:51:08 UTC (rev 7355) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-08-05 00:05:37 UTC (rev 7356) @@ -606,7 +606,6 @@ segs = nlist[:nseg] kinds = nlist[nseg:] - paths = self._make_paths(segs, kinds) col = collections.PathCollection(paths, @@ -652,8 +651,10 @@ codes = np.zeros(kind.shape, dtype=mpath.Path.code_type) codes.fill(mpath.Path.LINETO) codes[0] = mpath.Path.MOVETO - # Attempted slit removal is disabled until we get it right. - #codes[kind >= _cntr._slitkind] = mpath.Path.MOVETO + # points that begin a slit or are in it: + in_slit = kind[:-1] >= _cntr._slitkind + # use moveto for any point *following* such a point + codes[1:][in_slit] = mpath.Path.MOVETO paths.append(mpath.Path(seg, codes)) return paths Modified: trunk/matplotlib/src/cntr.c =================================================================== --- trunk/matplotlib/src/cntr.c 2009-08-04 19:51:08 UTC (rev 7355) +++ trunk/matplotlib/src/cntr.c 2009-08-05 00:05:37 UTC (rev 7356) @@ -1326,7 +1326,7 @@ /* Build a list of XY 2-D arrays, shape (N,2), to which a list of K arrays - is concatenated concatenated. */ + is concatenated. */ static PyObject * build_cntr_list_v2(long *np, double *xp, double *yp, short *kp, int nparts, long ntotal) @@ -1653,6 +1653,29 @@ return cntr_trace(self->site, levels, nlevels, nchunk); } +/* The following will not normally be called. It is experimental, + and intended for future debugging. It may go away at any time. +*/ +static PyObject * +Cntr_get_cdata(Cntr *self) +{ + PyArrayObject *Cdata; + npy_intp dims[2]; + int i, j; + int ni, nj; + + dims[0] = ni = self->site->imax; + dims[1] = nj = self->site->jmax; + + Cdata = (PyArrayObject *) PyArray_SimpleNew(2, dims, PyArray_SHORT); + for (j=0; j<nj; j++) + for (i=0; i<ni; i++) + Cdata->data[j + i*nj] = self->site->data[i + j*ni]; + /* output is C-order, input is F-order */ + /* for now we are ignoring the last ni+1 values */ + return (PyObject *)Cdata; +} + static PyMethodDef Cntr_methods[] = { {"trace", (PyCFunction)Cntr_trace, METH_VARARGS | METH_KEYWORDS, "Return a list of contour line segments or polygons.\n\n" @@ -1665,6 +1688,12 @@ " Optional argument: nchunk; approximate number of grid points\n" " per chunk. 0 (default) for no chunking.\n" }, + {"get_cdata", (PyCFunction)Cntr_get_cdata, METH_NOARGS, + "Returns a copy of the mesh array with contour calculation codes.\n\n" + "Experimental and incomplete; we are not returning quite all of\n" + "the array.\n" + "Don't call this unless you are exploring the dark recesses of cntr.c\n" + }, {0, 0, 0, 0} /* Sentinel */ }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |