From: Michael D. <md...@st...> - 2008-06-05 19:16:28
|
I've gone ahead and fixed this in the Polygon patch. As you point out, if someone wants an open polygon, they can use PathPatch, and Polygon was never able to do that before anyway. Cheers, Mike Eric Firing wrote: > Michael Droettboom wrote: >> Thanks. That's a good argument to do the close for fill(). I'll >> wait a bit to see if others chime in, but at least at that level it >> seems to be a no-brainer. Whether we want to do this in the Polygon >> patch is still an open question, perhaps. > > Mike, > > Let's see if anyone says anything either way. If no one does, then I > suggest that you should be the one to decide whether it makes sense to > make the change in patches or in fill. If the ultimate decision is to > change patches, then that is simpler, and there is no point in making > the slightly more complicated changes in axes. In either case, I > think the closing should be done only if a test shows that the points > passed in are not already closed. > > Looking at patches a little more, I think I would be inclined to put > the change in Polygon, on the grounds that a polygon simply is a > *closed* path specified by its vertices; there should be no need to > explicitly close it, although it may be more efficient to do so. For > the case where someone wants a general path, it looks like you have > thoughtfully provided the PathPatch object, so we don't really lose > generality by forcing the Polygon to be closed. > > Eric > > > >> >> Cheers, >> Mike >> >> Eric Firing wrote: >>> Eric Firing wrote: >>>> Michael Droettboom wrote: >>>>> I'm not entirely certain this is desirable behavior -- what if the >>>>> user *wants* to draw an open-yet-filled polygon? How could that >>>>> be done? (Admittedly, it couldn't be done before). It seems more >>>>> general to require the user to close polygons. >>>> >>>> True. I don't feel strongly about this. My guess is that at least >>>> at the level of the Axes.fill method, a user would almost never >>>> want the open-yet-filled case, but I could be guessing wrong, or >>>> the "almost" qualifier could be critical. We could do automatic >>>> closing only at that level, however. >>>> >>>> Maybe the best alternative is to leave the trunk behavior as it is, >>>> and make sure the documentation is very explicit about the need to >>>> supply a closed path. This change could be added to API_CHANGES, >>>> as well as to the Axes.fill docstring. >>>> >>>> Does anyone know how Matlab, IDL, etc. handle this? >>> >>> Here is the Matlab help text; matlab does automatically close the >>> polygons: >>> >>> fill(X,Y,C) creates filled polygons from the data in X and Y with >>> vertex color specified by C. C is a vector or matrix used as an >>> index into the colormap. If C is a row vector, length(C) must equal >>> size(X,2) and size(Y,2); if C is a column vector, length(C) must >>> equal size(X,1) and size(Y,1). If necessary, fill closes the polygon >>> by connecting the last vertex to the first. >>> >>> Eric >> > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |