Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7479ef

Browse files
committed
patches.Arc.get_path returns the original arc path (instead of ellipse or truncated arc)
svn path=/trunk/matplotlib/; revision=7857
1 parent b95eefb commit b7479ef

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lib/matplotlib/patches.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,9 @@ def __init__(self, xy, width, height, angle=0.0, theta1=0.0, theta2=360.0, **kwa
12191219
self.theta1 = theta1
12201220
self.theta2 = theta2
12211221

1222+
self._path = Path.arc(self.theta1, self.theta2)
1223+
1224+
12221225
@allow_rasterization
12231226
def draw(self, renderer):
12241227
"""
@@ -1278,7 +1281,7 @@ def draw(self, renderer):
12781281
inv_error = (1.0 / 1.89818e-6) * 0.5
12791282

12801283
if width < inv_error and height < inv_error:
1281-
self._path = Path.arc(self.theta1, self.theta2)
1284+
#self._path = Path.arc(self.theta1, self.theta2)
12821285
return Patch.draw(self, renderer)
12831286

12841287
def iter_circle_intersect_on_line(x0, y0, x1, y1):
@@ -1360,15 +1363,22 @@ def iter_circle_intersect_on_line_seg(x0, y0, x1, y1):
13601363
last_theta = theta1
13611364
theta1_rad = theta1 * DEG2RAD
13621365
inside = box_path.contains_point((np.cos(theta1_rad), np.sin(theta1_rad)))
1366+
1367+
# save original path
1368+
path_original = self._path
13631369
for theta in thetas:
13641370
if inside:
1365-
self._path = Path.arc(last_theta, theta, 8)
1371+
_path = Path.arc(last_theta, theta, 8)
13661372
Patch.draw(self, renderer)
13671373
inside = False
13681374
else:
13691375
inside = True
13701376
last_theta = theta
13711377

1378+
# restore original path
1379+
self._path = path_original
1380+
1381+
13721382
def bbox_artist(artist, renderer, props=None, fill=True):
13731383
"""
13741384
This is a debug function to draw a rectangle around the bounding

0 commit comments

Comments
 (0)