Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1096596

Browse files
committed
Replace some polar baseline images by check_figures_equal.
1 parent38fd0c2 commit1096596

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

Lines 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

Lines 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

Lines 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

Lines changed: 0 additions & 1357 deletions
This file was deleted.

‎lib/matplotlib/tests/test_axes.py

Lines 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-
deftest_polar_wrap():
637+
deftest_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
assertlen(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+
deftest_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-
deftest_polar_units():
654+
@check_figures_equal()
655+
deftest_polar_units_1(fig_test,fig_ref):
656656
importmatplotlib.testing.jpl_unitsasunits
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.degforxinxs],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*kmforyinys]
671-
plt.polar(xs,ykm,color="blue",thetaunits="rad",runits="km")
669+
@check_figures_equal()
670+
deftest_polar_units_2(fig_test,fig_ref):
671+
importmatplotlib.testing.jpl_unitsasunits
672+
units.register()
673+
xs= [30.0,45.0,60.0,90.0]
674+
xs_deg= [x*units.degforxinxs]
675+
ys= [1.0,2.0,3.0,4.0]
676+
ys_km= [y*units.kmforyinys]
677+
678+
plt.figure(fig_test.number)
679+
# test {theta,r}units.
680+
plt.polar(xs_deg,ys_km,thetaunits="rad",runits="km")
672681
assertisinstance(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
deftest_polar_rmin():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp