@@ -1122,19 +1122,26 @@ def cla(self):
1122
1122
size = mpl .rcParams ['axes.titlesize' ],
1123
1123
weight = mpl .rcParams ['axes.titleweight' ])
1124
1124
1125
+ y = mpl .rcParams ['axes.titley' ]
1126
+ if y is None :
1127
+ y = 1.0
1128
+ self ._autotitlepos = True
1129
+ else :
1130
+ self ._autotitlepos = False
1131
+
1125
1132
self .title = mtext .Text (
1126
- x = 0.5 , y = 1.0 , text = '' ,
1133
+ x = 0.5 , y = y , text = '' ,
1127
1134
fontproperties = props ,
1128
1135
verticalalignment = 'baseline' ,
1129
1136
horizontalalignment = 'center' ,
1130
1137
)
1131
1138
self ._left_title = mtext .Text (
1132
- x = 0.0 , y = 1.0 , text = '' ,
1139
+ x = 0.0 , y = y , text = '' ,
1133
1140
fontproperties = props .copy (),
1134
1141
verticalalignment = 'baseline' ,
1135
1142
horizontalalignment = 'left' , )
1136
1143
self ._right_title = mtext .Text (
1137
- x = 1.0 , y = 1.0 , text = '' ,
1144
+ x = 1.0 , y = y , text = '' ,
1138
1145
fontproperties = props .copy (),
1139
1146
verticalalignment = 'baseline' ,
1140
1147
horizontalalignment = 'right' ,
@@ -1143,8 +1150,6 @@ def cla(self):
1143
1150
# refactor this out so it can be called in ax.set_title if
1144
1151
# pad argument used...
1145
1152
self ._set_title_offset_trans (title_offset_points )
1146
- # determine if the title position has been set manually:
1147
- self ._autotitlepos = None
1148
1153
1149
1154
for _title in (self .title , self ._left_title , self ._right_title ):
1150
1155
self ._set_artist_props (_title )
@@ -2622,16 +2627,6 @@ def _update_title_position(self, renderer):
2622
2627
2623
2628
titles = (self .title , self ._left_title , self ._right_title )
2624
2629
2625
- if self ._autotitlepos is None :
2626
- for title in titles :
2627
- x , y = title .get_position ()
2628
- if not np .isclose (y , 1.0 ):
2629
- self ._autotitlepos = False
2630
- _log .debug ('not adjusting title pos because a title was '
2631
- 'already placed manually: %f' , y )
2632
- return
2633
- self ._autotitlepos = True
2634
-
2635
2630
for title in titles :
2636
2631
x , _ = title .get_position ()
2637
2632
# need to start again in case of window resizing
0 commit comments