@@ -42,6 +42,59 @@ def test_get_labels():
42
42
assert ax .get_ylabel () == 'y label'
43
43
44
44
45
+ @check_figures_equal ()
46
+ def test_label_loc_vertical (fig_test , fig_ref ):
47
+ ax = fig_test .subplots ()
48
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
49
+ ax .set_ylabel ('YLabel' , loc = 'top' )
50
+ ax .set_xlabel ('XLabel' , loc = 'right' )
51
+ cbar = fig_test .colorbar (sc )
52
+
10000
cbar .set_label ("ZLabel" , loc = 'top' )
53
+
54
+ ax = fig_ref .subplots ()
55
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
56
+ ax .set_ylabel ('YLabel' , y = 1 , ha = 'right' )
57
+ ax .set_xlabel ('XLabel' , x = 1 , ha = 'right' )
58
+ cbar = fig_ref .colorbar (sc )
59
+ cbar .set_label ("ZLabel" , y = 1 , ha = 'right' )
60
+
61
+
62
+ @check_figures_equal ()
63
+ def test_label_loc_horizontal (fig_test , fig_ref ):
64
+ ax = fig_test .subplots ()
65
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
66
+ ax .set_ylabel ('YLabel' , loc = 'bottom' )
67
+ ax .set_xlabel ('XLabel' , loc = 'left' )
68
+ cbar = fig_test .colorbar (sc , orientation = 'horizontal' )
69
+ cbar .set_label ("ZLabel" , loc = 'left' )
70
+
71
+ ax = fig_ref .subplots ()
72
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
73
+ ax .set_ylabel ('YLabel' , y = 0 , ha = 'left' )
74
+ ax .set_xlabel ('XLabel' , x = 0 , ha = 'left' )
75
+ cbar = fig_ref .colorbar (sc , orientation = 'horizontal' )
76
+ cbar .set_label ("ZLabel" , x = 0 , ha = 'left' )
77
+
78
+
79
+ @check_figures_equal ()
80
+ def test_label_loc_rc (fig_test , fig_ref ):
81
+ with matplotlib .rc_context ({"xaxis.labellocation" : "right" ,
82
+ "yaxis.labellocation" : "top" }):
83
+ ax = fig_test .subplots ()
84
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
85
+ ax .set_ylabel ('YLabel' )
86
+ ax .set_xlabel ('XLabel' )
87
+ cbar = fig_test .colorbar (sc , orientation = 'horizontal' )
88
+ cbar .set_label ("ZLabel" )
89
+
90
+ ax = fig_ref .subplots ()
91
+ sc = ax .scatter ([1 , 2 ], [1 , 2 ], c = [1 , 2 ])
92
+ ax .set_ylabel ('YLabel' , y = 1 , ha = 'right' )
93
+ ax .set_xlabel ('XLabel' , x = 1 , ha = 'right' )
94
+ cbar = fig_ref .colorbar (sc , orientation = 'horizontal' )
95
+ cbar .set_label ("ZLabel" , x = 1 , ha = 'right' )
96
+
97
+
45
98
@image_comparison (['acorr.png' ], style = 'mpl20' )
46
99
def test_acorr ():
47
100
# Remove this line when this test image is regenerated.
0 commit comments