diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index c765522d5eb8..4404fb25845b 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -1737,7 +1737,7 @@ def iter_circle_intersect_on_line_seg(x0, y0, x1, y1): path_original = self._path for theta in thetas: if inside: - Path.arc(last_theta, theta, 8) + self._path = Path.arc(last_theta, theta, 8) Patch.draw(self, renderer) inside = False else: diff --git a/lib/matplotlib/tests/baseline_images/test_axes/arc_angles.png b/lib/matplotlib/tests/baseline_images/test_axes/arc_angles.png index 82a9840913f3..8b81cde703ef 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/arc_angles.png and b/lib/matplotlib/tests/baseline_images/test_axes/arc_angles.png differ diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index f6e92b70c6ac..125d2b606132 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1206,22 +1206,32 @@ def test_arc_angles(): w = 2 h = 1 centre = (0.2, 0.5) + scale = 2 fig, axs = plt.subplots(3, 3) for i, ax in enumerate(axs.flat): theta2 = i * 360 / 9 theta1 = theta2 - 45 + ax.add_patch(patches.Ellipse(centre, w, h, alpha=0.3)) ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) # Straight lines intersecting start and end of arc - ax.plot([2 * np.cos(np.deg2rad(theta1)) + centre[0], + ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0], centre[0], - 2 * np.cos(np.deg2rad(theta2)) + centre[0]], - [2 * np.sin(np.deg2rad(theta1)) + centre[1], + scale * np.cos(np.deg2rad(theta2)) + centre[0]], + [scale * np.sin(np.deg2rad(theta1)) + centre[1], centre[1], - 2 * np.sin(np.deg2rad(theta2)) + centre[1]]) - ax.set_xlim(-2, 2) - ax.set_ylim(-2, 2) + scale * np.sin(np.deg2rad(theta2)) + centre[1]]) + + ax.set_xlim(-scale, scale) + ax.set_ylim(-scale, scale) + + # This looks the same, but it triggers a different code path when it + # gets large enough. + w *= 10 + h *= 10 + centre = (centre[0] * 10, centre[1] * 10) + scale *= 10 @image_comparison(baseline_images=['arc_ellipse'],