FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace some polar baseline images by check_figures_equal. by anntzer · Pull Request #14888 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pdf  (4) .png  (4) .py  (1) .svg  (4) All 4 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Binary file not shown.
Binary file not shown.
1,685 changes: 0 additions & 1,685 deletions lib/matplotlib/tests/baseline_images/test_axes/polar_units.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
1,794 changes: 0 additions & 1,794 deletions lib/matplotlib/tests/baseline_images/test_axes/polar_units_2.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
1,335 changes: 0 additions & 1,335 deletions lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
1,357 changes: 0 additions & 1,357 deletions lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.svg

This file was deleted.

62 changes: 38 additions & 24 deletions lib/matplotlib/tests/test_axes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

Back | FazBrowse Home | New Git URL