6
6
from matplotlib .testing .decorators import image_comparison
7
7
from mpl_toolkits .axisartist .axislines import Subplot
8
8
from mpl_toolkits .axisartist .floating_axes import (
9
- FloatingSubplot ,
10
- GridHelperCurveLinear )
9
+ FloatingAxes , GridHelperCurveLinear )
11
10
from mpl_toolkits .axisartist .grid_finder import FixedLocator
12
11
from mpl_toolkits .axisartist import angle_helper
13
12
@@ -26,37 +25,27 @@ def test_curvelinear3():
26
25
27
26
tr = (mtransforms .Affine2D ().scale (np .pi / 180 , 1 ) +
28
27
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 )
44
36
45
37
r_scale = 10
46
38
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 ]))
52
43
53
44
ax1 .axis ["right" ] = axis = grid_helper2 .new_fixed_axis ("right" , axes = ax1 )
54
45
55
46
ax1 .axis ["left" ].label .set_text ("Test 1" )
56
47
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 )
60
49
61
50
axis = grid_helper .new_floating_axis (1 , 7 , axes = ax1 ,
62
51
axis_direction = "bottom" )
@@ -85,27 +74,18 @@ def test_curvelinear4():
85
74
86
75
tr = (mtransforms .Affine2D ().scale (np .pi / 180 , 1 ) +
87
76
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 )
103
85
104
86
ax1 .axis ["left" ].label .set_text ("Test 1" )
105
87
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 )
109
89
110
90
axis = grid_helper .new_floating_axis (1 , 70 , axes = ax1 ,
111
91
axis_direction = "bottom" )
0 commit comments