@@ -1122,19 +1122,26 @@ def cla(self):
11221122 size = mpl .rcParams ['axes.titlesize' ],
11231123 weight = mpl .rcParams ['axes.titleweight' ])
11241124
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+
11251132 self .title = mtext .Text (
1126- x = 0.5 , y = 1.0 , text = '' ,
1133+ x = 0.5 , y = y , text = '' ,
11271134 fontproperties = props ,
11281135 verticalalignment = 'baseline' ,
11291136 horizontalalignment = 'center' ,
11301137 )
11311138 self ._left_title = mtext .Text (
1132- x = 0.0 , y = 1.0 , text = '' ,
1139+ x = 0.0 , y = y , text = '' ,
11331140 fontproperties = props .copy (),
11341141 verticalalignment = 'baseline' ,
11351142 horizontalalignment = 'left' , )
11361143 self ._right_title = mtext .Text (
1137- x = 1.0 , y = 1.0 , text = '' ,
1144+ x = 1.0 , y = y , text = '' ,
11381145 fontproperties = props .copy (),
11391146 verticalalignment = 'baseline' ,
11401147 horizontalalignment = 'right' ,
@@ -1143,8 +1150,6 @@ def cla(self):
11431150 # refactor this out so it can be called in ax.set_title if
11441151 # pad argument used...
11451152 self ._set_title_offset_trans (title_offset_points )
1146- # determine if the title position has been set manually:
1147- self ._autotitlepos = None
11481153
11491154 for _title in (self .title , self ._left_title , self ._right_title ):
11501155 self ._set_artist_props (_title )
@@ -2622,16 +2627,6 @@ def _update_title_position(self, renderer):
26222627
26232628 titles = (self .title , self ._left_title , self ._right_title )
26242629
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-
26352630 for title in titles :
26362631 x , _ = title .get_position ()
26372632 # need to start again in case of window resizing
0 commit comments