Skip to content

Commit a4d8129

Browse files
committed
TST
1 parent 14d5441 commit a4d8129

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

lib/matplotlib/path.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -986,22 +986,20 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False, wrap=True):
986986
987987
Notes
988988
-----
989-
The arc is approximated using cubic Bézier curves, as described in
990-
Masionobe, L. 2003. `Drawing an elliptical arc using polylines,
991-
quadratic or cubic Bezier curves
992-
<https://web.archive.org/web/20190318044212/http://www.spaceroots.org/documents/ellipse/index.html>`_.
989+
The arc is approximated using cubic Bézier curves, as described in
990+
Masionobe, L. 2003. `Drawing an elliptical arc using polylines,
991+
quadratic or cubic Bezier curves
992+
<https://web.archive.org/web/20190318044212/http://www.spaceroots.org/documents/ellipse/index.html>`_.
993993
"""
994994

995995
eta1 = theta1
996996
if wrap:
997997
# Wrap theta2 to 0-360 degrees from theta1.
998998
eta2 = np.mod(theta2 - theta1, 360.0) + theta1
999-
print('Eta1, Eta20', eta1, eta2)
1000999
# Ensure 360-deg range is not flattened to 0 due to floating-point
10011000
# errors, but don't try to expand existing 0 range.
10021001
if theta2 != theta1 and eta2 <= eta1:
10031002
eta2 += 360
1004-
print('Eta1, Eta2', eta1, eta2)
10051003
else:
10061004
eta2 = theta2
10071005
eta1, eta2 = np.deg2rad([eta1, eta2])
@@ -1012,9 +1010,8 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False, wrap=True):
10121010
# this doesn't need to grow exponentially, but we have left
10131011
# this way for back compatibility
10141012
n = int(2 ** np.ceil(2 * np.abs(eta2 - eta1) / np.pi))
1015-
print('Here')
10161013
else:
1017-
# this will not grow exponentially if we allow wrapping arcs:
1014+
# this will grow linearly if we allow wrapping arcs:
10181015
n = int(2 * np.ceil(2 * np.abs(eta2 - eta1) / np.pi))
10191016
if n < 1:
10201017
raise ValueError("n must be >= 1 or None")
Loading

lib/matplotlib/tests/test_path.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def test_full_arc(offset):
481481
@image_comparison(['arc_close360'], style='default', remove_text=True,
482482
extensions=['png'])
483483
def test_arc_close360():
484-
fig, ax = plt.subplots(ncols=3)
484+
_, ax = plt.subplots(ncols=3)
485485
ax[0].add_patch(patches.PathPatch(Path.arc(theta1=-90 - 1e-14, theta2=270)))
486486
#ax[0].set_title("arc(-90-1e-14, 270), should be a circle")
487487
ax[1].add_patch(patches.PathPatch(Path.arc(theta1=-90, theta2=270)))
@@ -494,6 +494,26 @@ def test_arc_close360():
494494
a.set_aspect("equal")
495495

496496

497+
@image_comparison(['arc_wrap_false'], style='default', remove_text=True,
498+
extensions=['png'])
499+
def test_arc_wrap_false():
500+
_, ax = plt.subplots(2, 2)
501+
ax = ax.flatten()
502+
ax[0].add_patch(patches.PathPatch(Path.arc(theta1=10, theta2=20,
503+
is_wedge=True, wrap=True)))
504+
ax[1].add_patch(patches.PathPatch(Path.arc(theta1=10, theta2=380,
505+
is_wedge=True, wrap=True)))
506+
ax[2].add_patch(patches.PathPatch(Path.arc(theta1=10, theta2=20,
507+
is_wedge=True, wrap=False)))
508+
ax[3].add_patch(patches.PathPatch(Path.arc(theta1=10, theta2=740,
509+
is_wedge=True, wrap=False)))
510+
for a in ax:
511+
a.set_xlim(-1, 1)
512+
a.set_ylim(-1, 1)
513+
a.set_aspect("equal")
514+
515+
516+
497517
def test_disjoint_zero_length_segment():
498518
this_path = Path(
499519
np.array([

0 commit comments

Comments
 (0)