diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf b/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf deleted file mode 100644 index e40ac038d862..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.png b/lib/matplotlib/tests/baseline_images/test_axes/polar_units.png deleted file mode 100644 index 31298d14bb4a..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.png and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg b/lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg deleted file mode 100644 index 94d88823eea1..000000000000 --- a/lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg +++ /dev/null @@ -1,1685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.pdf b/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.pdf deleted file mode 100644 index ee9da936fb16..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.pdf and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.png b/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.png deleted file mode 100644 index 740d05d525e7..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.png and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg b/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg deleted file mode 100644 index 9c8b712c8aff..000000000000 --- a/lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg +++ /dev/null @@ -1,1794 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf deleted file mode 100644 index e14fc4e70436..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.png b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.png deleted file mode 100644 index c5fbe06c5106..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.png and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg deleted file mode 100644 index 0cbd8216777e..000000000000 --- a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg +++ /dev/null @@ -1,1335 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf deleted file mode 100644 index 3071d45a43ad..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.png b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.png deleted file mode 100644 index d95001b70742..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.png and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg b/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg deleted file mode 100644 index 5d4479e6acab..000000000000 --- a/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg +++ /dev/null @@ -1,1357 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 7830cde5f50d..9190dafd6cc4 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -634,44 +634,58 @@ def test_const_xy(): plt.plot(np.ones(10), np.ones(10), 'o') -@image_comparison(['polar_wrap_180', 'polar_wrap_360'], style='default') -def test_polar_wrap(): +def test_polar_twice(): fig = plt.figure() - plt.subplot(111, polar=True) - plt.polar(np.deg2rad([179, -179]), [0.2, 0.1], "b.-") - plt.polar(np.deg2rad([179, 181]), [0.2, 0.1], "g.-") - plt.rgrids([0.05, 0.1, 0.15, 0.2, 0.25, 0.3]) + plt.polar([1, 2], [.1, .2]) + plt.polar([3, 4], [.3, .4]) assert len(fig.axes) == 1, 'More than one polar axes created.' - fig = plt.figure() - plt.subplot(111, polar=True) - plt.polar(np.deg2rad([2, -2]), [0.2, 0.1], "b.-") - plt.polar(np.deg2rad([2, 358]), [0.2, 0.1], "g.-") - plt.polar(np.deg2rad([358, 2]), [0.2, 0.1], "r.-") - plt.rgrids([0.05, 0.1, 0.15, 0.2, 0.25, 0.3]) + +@check_figures_equal() +def test_polar_wrap(fig_test, fig_ref): + ax = fig_test.add_subplot(projection="polar") + ax.plot(np.deg2rad([179, -179]), [0.2, 0.1]) + ax.plot(np.deg2rad([2, -2]), [0.2, 0.1]) + ax = fig_ref.add_subplot(projection="polar") + ax.plot(np.deg2rad([179, 181]), [0.2, 0.1]) + ax.plot(np.deg2rad([2, 358]), [0.2, 0.1]) -@image_comparison(['polar_units', 'polar_units_2'], style='default') -def test_polar_units(): +@check_figures_equal() +def test_polar_units_1(fig_test, fig_ref): import matplotlib.testing.jpl_units as units units.register() + xs = [30.0, 45.0, 60.0, 90.0] + ys = [1.0, 2.0, 3.0, 4.0] - deg = units.deg - km = units.km + plt.figure(fig_test.number) + plt.polar([x * units.deg for x in xs], ys) - xs = [30.0*deg, 45.0*deg, 60.0*deg, 90.0*deg] - ys = [1.0, 2.0, 3.0, 4.0] + ax = fig_ref.add_subplot(projection="polar") + ax.plot(np.deg2rad(xs), ys) + ax.set(xlabel="deg") - plt.figure() - plt.polar(xs, ys, color="blue") - plt.figure() - # make sure runits and theta units work - ykm = [y*km for y in ys] - plt.polar(xs, ykm, color="blue", thetaunits="rad", runits="km") +@check_figures_equal() +def test_polar_units_2(fig_test, fig_ref): + import matplotlib.testing.jpl_units as units + units.register() + xs = [30.0, 45.0, 60.0, 90.0] + xs_deg = [x * units.deg for x in xs] + ys = [1.0, 2.0, 3.0, 4.0] + ys_km = [y * units.km for y in ys] + + plt.figure(fig_test.number) + # test {theta,r}units. + plt.polar(xs_deg, ys_km, thetaunits="rad", runits="km") assert isinstance(plt.gca().get_xaxis().get_major_formatter(), units.UnitDblFormatter) + ax = fig_ref.add_subplot(projection="polar") + ax.plot(np.deg2rad(xs), ys) + ax.xaxis.set_major_formatter(mticker.FuncFormatter("{:.12}".format)) + ax.set(xlabel="rad", ylabel="km") + @image_comparison(['polar_rmin'], style='default') def test_polar_rmin():