SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] partial ring patch

From: Paul K. <Pau...@ni...> - 2008年11月13日 18:01:29
Attachments: ring.py
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?
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?
 - Paul

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /