Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 84c7ffb

Browse filesBrowse files
dstansbyMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #9661: Fix arcs with very large width/height.
1 parent 9527ba5 commit 84c7ffb
Copy full SHA for 84c7ffb

File tree

Expand file treeCollapse file tree

3 files changed

+17
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+17
-7
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+16-6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.