(self)
| 2323 | self._path = Path.arc(self._theta1, self._theta2) |
| 2324 | |
| 2325 | def _theta_stretch(self): |
| 2326 | # If the width and height of ellipse are not equal, take into account |
| 2327 | # stretching when calculating angles to draw between |
| 2328 | def theta_stretch(theta, scale): |
| 2329 | theta = np.deg2rad(theta) |
| 2330 | x = np.cos(theta) |
| 2331 | y = np.sin(theta) |
| 2332 | stheta = np.rad2deg(np.arctan2(scale * y, x)) |
| 2333 | # arctan2 has the range [-pi, pi], we expect [0, 2*pi] |
| 2334 | return (stheta + 360) % 360 |
| 2335 | |
| 2336 | width = self.convert_xunits(self.width) |
| 2337 | height = self.convert_yunits(self.height) |
| 2338 | if ( |
| 2339 | # if we need to stretch the angles because we are distorted |
| 2340 | width != height |
| 2341 | # and we are not doing a full circle. |
| 2342 | # |
| 2343 | # 0 and 360 do not exactly round-trip through the angle |
| 2344 | # stretching (due to both float precision limitations and |
| 2345 | # the difference between the range of arctan2 [-pi, pi] and |
| 2346 | # this method [0, 360]) so avoid doing it if we don't have to. |
| 2347 | and not (self.theta1 != self.theta2 and |
| 2348 | self.theta1 % 360 == self.theta2 % 360) |
| 2349 | ): |
| 2350 | theta1 = theta_stretch(self.theta1, width / height) |
| 2351 | theta2 = theta_stretch(self.theta2, width / height) |
| 2352 | return theta1, theta2, width, height |
| 2353 | return self.theta1, self.theta2, width, height |
| 2354 | |
| 2355 | |
| 2356 | def bbox_artist(artist, renderer, props=None, fill=True): |
no test coverage detected