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 1096596

Browse filesBrowse files
committed
Replace some polar baseline images by check_figures_equal.
1 parent 38fd0c2 commit 1096596
Copy full SHA for 1096596
Expand file treeCollapse file tree

13 files changed

+38
-6195
lines changed
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg
-1,685Lines changed: 0 additions & 1685 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg
-1,794Lines changed: 0 additions & 1794 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg
-1,335Lines changed: 0 additions & 1335 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg
-1,357Lines changed: 0 additions & 1357 deletions
This file was deleted.

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+38-24Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -634,44 +634,58 @@ def test_const_xy():
634634
plt.plot(np.ones(10), np.ones(10), 'o')
635635

636636

637-
@image_comparison(['polar_wrap_180', 'polar_wrap_360'], style='default')
638-
def test_polar_wrap():
637+
def test_polar_twice():
639638
fig = plt.figure()
640-
plt.subplot(111, polar=True)
641-
plt.polar(np.deg2rad([179, -179]), [0.2, 0.1], "b.-")
642-
plt.polar(np.deg2rad([179, 181]), [0.2, 0.1], "g.-")
643-
plt.rgrids([0.05, 0.1, 0.15, 0.2, 0.25, 0.3])
639+
plt.polar([1, 2], [.1, .2])
640+
plt.polar([3, 4], [.3, .4])
644641
assert len(fig.axes) == 1, 'More than one polar axes created.'
645642

646-
fig = plt.figure()
647-
plt.subplot(111, polar=True)
648-
plt.polar(np.deg2rad([2, -2]), [0.2, 0.1], "b.-")
649-
plt.polar(np.deg2rad([2, 358]), [0.2, 0.1], "g.-")
650-
plt.polar(np.deg2rad([358, 2]), [0.2, 0.1], "r.-")
651-
plt.rgrids([0.05, 0.1, 0.15, 0.2, 0.25, 0.3])
643+
644+
@check_figures_equal()
645+
def test_polar_wrap(fig_test, fig_ref):
646+
ax = fig_test.add_subplot(projection="polar")
647+
ax.plot(np.deg2rad([179, -179]), [0.2, 0.1])
648+
ax.plot(np.deg2rad([2, -2]), [0.2, 0.1])
649+
ax = fig_ref.add_subplot(projection="polar")
650+
ax.plot(np.deg2rad([179, 181]), [0.2, 0.1])
651+
ax.plot(np.deg2rad([2, 358]), [0.2, 0.1])
652652

653653

654-
@image_comparison(['polar_units', 'polar_units_2'], style='default')
655-
def test_polar_units():
654+
@check_figures_equal()
655+
def test_polar_units_1(fig_test, fig_ref):
656656
import matplotlib.testing.jpl_units as units
657657
units.register()
658+
xs = [30.0, 45.0, 60.0, 90.0]
659+
ys = [1.0, 2.0, 3.0, 4.0]
658660

659-
deg = units.deg
660-
km = units.km
661+
plt.figure(fig_test.number)
662+
plt.polar([x * units.deg for x in xs], ys)
661663

662-
xs = [30.0*deg, 45.0*deg, 60.0*deg, 90.0*deg]
663-
ys = [1.0, 2.0, 3.0, 4.0]
664+
ax = fig_ref.add_subplot(projection="polar")
665+
ax.plot(np.deg2rad(xs), ys)
666+
ax.set(xlabel="deg")
664667

665-
plt.figure()
666-
plt.polar(xs, ys, color="blue")
667668

668-
plt.figure()
669-
# make sure runits and theta units work
670-
ykm = [y*km for y in ys]
671-
plt.polar(xs, ykm, color="blue", thetaunits="rad", runits="km")
669+
@check_figures_equal()
670+
def test_polar_units_2(fig_test, fig_ref):
671+
import matplotlib.testing.jpl_units as units
672+
units.register()
673+
xs = [30.0, 45.0, 60.0, 90.0]
674+
xs_deg = [x * units.deg for x in xs]
675+
ys = [1.0, 2.0, 3.0, 4.0]
676+
ys_km = [y * units.km for y in ys]
677+
678+
plt.figure(fig_test.number)
679+
# test {theta,r}units.
680+
plt.polar(xs_deg, ys_km, thetaunits="rad", runits="km")
672681
assert isinstance(plt.gca().get_xaxis().get_major_formatter(),
673682
units.UnitDblFormatter)
674683

684+
ax = fig_ref.add_subplot(projection="polar")
685+
ax.plot(np.deg2rad(xs), ys)
686+
ax.xaxis.set_major_formatter(mticker.FuncFormatter("{:.12}".format))
687+
ax.set(xlabel="rad", ylabel="km")
688+
675689

676690
@image_comparison(['polar_rmin'], style='default')
677691
def test_polar_rmin():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.