1818from matplotlib .transforms import Affine2D
1919
2020from mpl_toolkits .axisartist import (
21- angle_helper , Subplot , SubplotHost , ParasiteAxesAuxTrans )
21+ angle_helper , Axes , HostAxes , ParasiteAxesAuxTrans )
2222from mpl_toolkits .axisartist .grid_helper_curvelinear import (
2323 GridHelperCurveLinear )
2424
@@ -38,14 +38,12 @@ def inv_tr(x, y):
3838
3939 grid_helper = GridHelperCurveLinear ((tr , inv_tr ))
4040
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 )
4242 # ax1 will have a ticks and gridlines defined by the given
4343 # transform (+ transData of the Axes). Note that the transform of
4444 # the Axes itself (i.e., transData) is not affected by the given
4545 # transform.
4646
47- fig .add_subplot (ax1 )
48-
4947 xx , yy = tr ([3 , 6 ], [5 , 10 ])
5048 ax1 .plot (xx , yy , linewidth = 2.0 )
5149
@@ -84,7 +82,8 @@ def curvelinear_test2(fig):
8482 grid_helper = GridHelperCurveLinear (
8583 tr , extreme_finder = extreme_finder ,
8684 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 )
8887
8988 # make ticklabels of right and top axis visible.
9089 ax1 .axis ["right" ].major_ticklabels .set_visible (True )
@@ -94,8 +93,6 @@ def curvelinear_test2(fig):
9493 # let bottom axis shows ticklabels for 2nd coordinate (radius)
9594 ax1 .axis ["bottom" ].get_helper ().nth_coord_ticks = 1
9695
97- fig .add_subplot (ax1 )
98-
9996 ax1 .set_aspect (1 )
10097 ax1 .set_xlim (- 5 , 12 )
10198 ax1 .set_ylim (- 5 , 10 )
0 commit comments