18
18
from matplotlib .transforms import Affine2D
19
19
20
20
from mpl_toolkits .axisartist import (
21
- angle_helper , Subplot , SubplotHost , ParasiteAxesAuxTrans )
21
+ angle_helper , Axes , HostAxes , ParasiteAxesAuxTrans )
22
22
from mpl_toolkits .axisartist .grid_helper_curvelinear import (
23
23
GridHelperCurveLinear )
24
24
@@ -38,14 +38,12 @@ def inv_tr(x, y):
38
38
39
39
grid_helper = GridHelperCurveLinear ((tr , inv_tr ))
40
40
41
- ax1 = Subplot ( fig , 1 , 2 , 1 , grid_helper = grid_helper )
41
+ ax1 = fig . add_subplot ( 1 , 2 , 1 , axes_class = Axes , grid_helper = grid_helper )
42
42
# ax1 will have a ticks and gridlines defined by the given
43
43
# transform (+ transData of the Axes). Note that the transform of
44
44
# the Axes itself (i.e., transData) is not affected by the given
45
45
# transform.
46
46
47
- fig .add_subplot (ax1 )
48
-
49
47
xx , yy = tr ([3 , 6 ], [5 , 10 ])
50
48
ax1 .plot (xx , yy , linewidth = 2.0 )
51
49
@@ -84,7 +82,8 @@ def curvelinear_test2(fig):
84
82
grid_helper = GridHelperCurveLinear (
85
83
tr , extreme_finder = extreme_finder ,
86
84
grid_locator1 = grid_locator1 , tick_formatter1 = tick_formatter1 )
87
- ax1 = SubplotHost (fig , 1 , 2 , 2 , grid_helper = grid_helper )
85
+ ax1 = fig .add_subplot (
86
+ 1 , 2 , 2 , axes_class = HostAxes , grid_helper = grid_helper )
88
87
89
88
# make ticklabels of right and top axis visible.
90
89
ax1 .axis ["right" ].major_ticklabels .set_visible (True )
@@ -94,8 +93,6 @@ def curvelinear_test2(fig):
94
93
# let bottom axis shows ticklabels for 2nd coordinate (radius)
95
94
ax1 .axis ["bottom" ].get_helper ().nth_coord_ticks = 1
96
95
97
- fig .add_subplot (ax1 )
98
-
99
96
ax1 .set_aspect (1 )
100
97
ax1 .set_xlim (- 5 , 12 )
101
98
ax1 .set_ylim (- 5 , 10 )
0 commit comments