66from matplotlib .testing .decorators import image_comparison
77from mpl_toolkits .axisartist .axislines import Subplot
88from mpl_toolkits .axisartist .floating_axes import (
9- FloatingSubplot ,
10- GridHelperCurveLinear )
9+ FloatingAxes , GridHelperCurveLinear )
1110from mpl_toolkits .axisartist .grid_finder import FixedLocator
1211from mpl_toolkits .axisartist import angle_helper
1312
@@ -26,37 +25,27 @@ def test_curvelinear3():
2625
2726 tr = (mtransforms .Affine2D ().scale (np .pi / 180 , 1 ) +
2827 mprojections .PolarAxes .PolarTransform ())
29-
30- grid_locator1 = angle_helper .LocatorDMS (15 )
31- tick_formatter1 = angle_helper .FormatterDMS ()
32-
33- grid_locator2 = FixedLocator ([2 , 4 , 6 , 8 , 10 ])
34-
35- grid_helper = GridHelperCurveLinear (tr ,
36- extremes = (0 , 360 , 10 , 3 ),
37- grid_locator1 = grid_locator1 ,
38- grid_locator2 = grid_locator2 ,
39- tick_formatter1 = tick_formatter1 ,
40- tick_formatter2 = None )
41-
42- ax1 = FloatingSubplot (fig , 111 , grid_helper = grid_helper )
43- fig .add_subplot (ax1 )
28+ grid_helper = GridHelperCurveLinear (
29+ tr ,
30+ extremes = (0 , 360 , 10 , 3 ),
31+ grid_locator1 = angle_helper .LocatorDMS (15 ),
32+ grid_locator2 = FixedLocator ([2 , 4 , 6 , 8 , 10 ]),
33+ tick_formatter1 = angle_helper .FormatterDMS (),
34+ tick_formatter2 = None )
35+ ax1 = fig .add_subplot (axes_class = FloatingAxes , grid_helper = grid_helper )
4436
4537 r_scale = 10
4638 tr2 = mtransforms .Affine2D ().scale (1 , 1 / r_scale ) + tr
47- grid_locator2 = FixedLocator ([30 , 60 , 90 ])
48- grid_helper2 = GridHelperCurveLinear (tr2 ,
49- extremes = (0 , 360 ,
50- 10 * r_scale , 3 * r_scale ),
51- grid_locator2 = grid_locator2 )
39+ grid_helper2 = GridHelperCurveLinear (
40+ tr2 ,
41+ extremes = (0 , 360 , 10 * r_scale , 3 * r_scale ),
42+ grid_locator2 = FixedLocator ([30 , 60 , 90 ]))
5243
5344 ax1 .axis ["right" ] = axis = grid_helper2 .new_fixed_axis ("right" , axes = ax1 )
5445
5546 ax1 .axis ["left" ].label .set_text ("Test 1" )
5647 ax1 .axis ["right" ].label .set_text ("Test 2" )
57-
58- for an in ["left" , "right" ]:
59- ax1 .axis [an ].set_visible (False )
48+ ax1 .axis ["left" , "right" ].set_visible (False )
6049
6150 axis = grid_helper .new_floating_axis (1 , 7 , axes = ax1 ,
6251 axis_direction = "bottom" )
@@ -85,27 +74,18 @@ def test_curvelinear4():
8574
8675 tr = (mtransforms .Affine2D ().scale (np .pi / 180 , 1 ) +
8776 mprojections .PolarAxes .PolarTransform ())
88-
89- grid_locator1 = angle_helper .LocatorDMS (5 )
90- tick_formatter1 = angle_helper .FormatterDMS ()
91-
92- grid_locator2 = FixedLocator ([2 , 4 , 6 , 8 , 10 ])
93-
94- grid_helper = GridHelperCurveLinear (tr ,
95- extremes = (120 , 30 , 10 , 0 ),
96- grid_locator1 = grid_locator1 ,
97- grid_locator2 = grid_locator2 ,
98- tick_formatter1 = tick_formatter1 ,
99- tick_formatter2 = None )
100-
101- ax1 = FloatingSubplot (fig , 111 , grid_helper = grid_helper )
102- fig .add_subplot (ax1 )
77+ grid_helper = GridHelperCurveLinear (
78+ tr ,
79+ extremes = (120 , 30 , 10 , 0 ),
80+ grid_locator1 = angle_helper .LocatorDMS (5 ),
81+ grid_locator2 = FixedLocator ([2 , 4 , 6 , 8 , 10 ]),
82+ tick_formatter1 = angle_helper .FormatterDMS (),
83+ tick_formatter2 = None )
84+ ax1 = fig .add_subplot (axes_class = FloatingAxes , grid_helper = grid_helper )
10385
10486 ax1 .axis ["left" ].label .set_text ("Test 1" )
10587 ax1 .axis ["right" ].label .set_text ("Test 2" )
106-
107- for an in ["top" ]:
108- ax1 .axis [an ].set_visible (False )
88+ ax1 .axis ["top" ].set_visible (False )
10989
11090 axis = grid_helper .new_floating_axis (1 , 70 , axes = ax1 ,
11191 axis_direction = "bottom" )
0 commit comments