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

Skip to content

Commit 9f767f0

Browse files
authored
Merge pull request #9667 from matplotlib/auto-backport-of-pr-9661
Backport PR #9661 on branch v2.1.x
2 parents 9527ba5 + 84c7ffb commit 9f767f0

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ def iter_circle_intersect_on_line_seg(x0, y0, x1, y1):
17331733
path_original = self._path
17341734
for theta in thetas:
17351735
if inside:
1736-
Path.arc(last_theta, theta, 8)
1736+
self._path = Path.arc(last_theta, theta, 8)
17371737
Patch.draw(self, renderer)
17381738
inside = False
17391739
else:
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,22 +1166,32 @@ def test_arc_angles():
11661166
w = 2
11671167
h = 1
11681168
centre = (0.2, 0.5)
1169+
scale = 2
11691170

11701171
fig, axs = plt.subplots(3, 3)
11711172
for i, ax in enumerate(axs.flat):
11721173
theta2 = i * 360 / 9
11731174
theta1 = theta2 - 45
1175+
11741176
ax.add_patch(patches.Ellipse(centre, w, h, alpha=0.3))
11751177
ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2))
11761178
# Straight lines intersecting start and end of arc
1177-
ax.plot([2 * np.cos(np.deg2rad(theta1)) + centre[0],
1179+
ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0],
11781180
centre[0],
1179-
2 * np.cos(np.deg2rad(theta2)) + centre[0]],
1180-
[2 * np.sin(np.deg2rad(theta1)) + centre[1],
1181+
scale * np.cos(np.deg2rad(theta2)) + centre[0]],
1182+
[scale * np.sin(np.deg2rad(theta1)) + centre[1],
11811183
centre[1],
1182-
2 * np.sin(np.deg2rad(theta2)) + centre[1]])
1183-
ax.set_xlim(-2, 2)
1184-
ax.set_ylim(-2, 2)
1184+
scale * np.sin(np.deg2rad(theta2)) + centre[1]])
1185+
1186+
ax.set_xlim(-scale, scale)
1187+
ax.set_ylim(-scale, scale)
1188+
1189+
# This looks the same, but it triggers a different code path when it
1190+
# gets large enough.
1191+
w *= 10
1192+
h *= 10
1193+
centre = (centre[0] * 10, centre[1] * 10)
1194+
scale *= 10
11851195

11861196

11871197
@image_comparison(baseline_images=['arc_ellipse'],

0 commit comments

Comments
 (0)