File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2663,7 +2663,7 @@ def _update_title_position(self, renderer):
26632663 bb = ax .get_window_extent (renderer )
26642664 if bb is not None :
26652665 top = max (top , bb .ymax )
2666- if top < 0 or top > 1 :
2666+ if top < 0 :
26672667 # the top of axes is not even on the figure, so don't try and
26682668 # automatically place it.
26692669 _log .debug ('top of axes not in the figure, so title not moved' )
Original file line number Diff line number Diff line change @@ -5533,6 +5533,19 @@ def test_title_xticks_top_both():
55335533 assert ax .title .get_position ()[1 ] > 1.04
55345534
55355535
5536+ def test_title_no_move_off_page ():
5537+ # If an axes is off the figure (ie. if it is cropped during a save)
5538+ # make sure that the automatic title repositioning does not get done.
5539+ mpl .rcParams ['axes.titley' ] = None
5540+ fig = plt .figure ()
5541+ ax = fig .add_axes ([0.1 , - 0.5 , 0.8 , 0.2 ])
5542+ ax .tick_params (axis = "x" ,
5543+ bottom = True , top = True , labelbottom = True , labeltop = True )
5544+ tt = ax .set_title ('Boo' )
5545+ fig .canvas .draw ()
5546+ assert tt .get_position ()[1 ] == 1.0
5547+
5548+
55365549def test_offset_label_color ():
55375550 # Tests issue 6440
55385551 fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments