Paul Kienzle wrote: > Hi, > > We found we needed to draw a partial ring, but didn't see one in > patches.py. > > Attached is a generalization of Wedge to accept an inner and an outer > radius. > > Should I add this to patches? Looks like a useful feature to me. Could be used for doing these sort of "hierarchical pie chart" graphs:
http://linux.byexamples.com/wp-content/uploads/2007/04/baobab.png Any reason not to implement this simply as an additional kwarg to Wedge, rather than a new class -- since Ring with a r2 == 0 is equivalent to Wedge anyway? Just thinking of having less code to maintain...but maybe that's more confusing for end users. > > Note that rather saving the unit ring and constructing a transform as > in Wedge: > > def get_patch_transform(self): > x = self.convert_xunits(self.center[0]) > y = self.convert_yunits(self.center[1]) > rx = self.convert_xunits(self.r2) > ry = self.convert_yunits(self.r2) > self._patch_transform = transforms.Affine2D() \ > .scale(rx, ry).translate(x, y) > return self._patch_transform > > I just transform the coordinates directly: > > v *= r2 > v += numpy.array(center) > self._path = Path(v,c) > self._patch_transform = transforms.IdentityTransform() > > Any reason to prefer one over the other? No strong reason. The reason I did it that way was so that if the patch were scaled or translated in an animation, the transformation of the wedge vertices would happen on-the-fly within backend_agg. It's not based on any benchmarking, but probably more on old habits from game programming (where it's common practice to keep shapes and transforms separated and let the hardware apply them). I doubt it matters here. Mike > > - Paul > > > ------------------------------------------------------------------------ > > > > > > > > One problem is that I had to explicitly set the axes limits 1because add_patch > > wasn't updating the limits to include the bounds of the new patch. > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel