File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2632,7 +2632,6 @@ def _update_title_position(self, renderer):
2632
2632
Update the title position based on the bounding box enclosing
2633
2633
all the ticklabels and x-axis spine and xlabel...
2634
2634
"""
2635
-
2636
2635
if self ._autotitlepos is not None and not self ._autotitlepos :
2637
2636
_log .debug ('title position was updated manually, not adjusting' )
2638
2637
return
@@ -2655,7 +2654,7 @@ def _update_title_position(self, renderer):
2655
2654
else :
2656
2655
ax .apply_aspect ()
2657
2656
axs = axs + [ax ]
2658
- top = 0
2657
+ top = - np . Inf
2659
2658
for ax in axs :
2660
2659
if (ax .xaxis .get_ticks_position () in ['top' , 'unknown' ]
2661
2660
or ax .xaxis .get_label_position () == 'top' ):
@@ -2664,6 +2663,11 @@ def _update_title_position(self, renderer):
2664
2663
bb = ax .get_window_extent (renderer )
2665
2664
if bb is not None :
2666
2665
top = max (top , bb .ymax )
2666
+ if top < 0 or top > 1 :
2667
+ # the top of axes is not even on the figure, so don't try and
2668
+ # automatically place it.
2669
+ _log .debug ('top of axes not in the figure, so title not moved' )
2670
+ return
2667
2671
if title .get_window_extent (renderer ).ymin < top :
2668
2672
_ , y = self .transAxes .inverted ().transform ((0 , top ))
2669
2673
title .set_position ((x , y ))
You can’t perform that action at this time.
0 commit comments