@@ -4073,16 +4073,38 @@ def test_axline(fig_test, fig_ref):
4073
4073
4074
4074
4075
4075
@check_figures_equal ()
4076
- def test_axline_transform (fig_test , fig_ref ):
4076
+ def test_axline_transaxes (fig_test , fig_ref ):
4077
4077
ax = fig_test .subplots ()
4078
4078
ax .set (xlim = (- 1 , 1 ), ylim = (- 1 , 1 ))
4079
4079
ax .axline_transaxes ((0 , 0 ), slope = 1 )
4080
4080
ax .axline_transaxes ((1 , 0.5 ), slope = 1 , color = 'C1' )
4081
+ ax .axline_transaxes ((0.5 , 0.5 ), slope = 0 , color = 'C2' )
4081
4082
4082
4083
ax = fig_ref .subplots ()
4083
4084
ax .set (xlim = (- 1 , 1 ), ylim = (- 1 , 1 ))
4084
4085
ax .plot ([- 1 , 1 ], [- 1 , 1 ])
4085
4086
ax .plot ([0 , 1 ], [- 1 , 0 ], color = 'C1' )
4087
+ ax .plot ([- 1 , 1 ], [0 , 0 ], color = 'C2' )
4088
+
4089
+
4090
+ @check_figures_equal ()
4091
+ def test_axline_transaxes_panzoom (fig_test , fig_ref ):
4092
+ # test that it is robust against pan/zoom and
4093
+ # figure resize after plotting
4094
+ ax = fig_test .subplots ()
4095
+ ax .set (xlim = (- 1 , 1 ), ylim = (- 1 , 1 ))
4096
+ ax .axline_transaxes ((0 , 0 ), slope = 1 )
4097
+ ax .axline_transaxes ((0.5 , 0.5 ), slope = 2 , color = 'C1' )
4098
+ ax .axline_transaxes ((0.5 , 0.5 ), slope = 0 , color = 'C2' )
4099
+ ax .set (xlim = (0 , 5 ), ylim = (0 , 10 ))
4100
+ fig_test .set_size_inches (3 , 3 )
4101
+
4102
+ ax = fig_ref .subplots ()
4103
+ ax .set (xlim = (0 , 5 ), ylim = (0 , 10 ))
4104
+ fig_ref .set_size_inches (3 , 3 )
4105
+ ax .plot ([0 , 5 ], [0 , 5 ])
4106
+ ax .plot ([0 , 5 ], [0 , 10 ], color = 'C1' )
4107
+ ax .plot ([0 , 5 ], [5 , 5 ], color = 'C2' )
4086
4108
4087
4109
4088
4110
def test_axline_args ():
0 commit comments