File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2632,7 +2632,6 @@ def _update_title_position(self, renderer):
26322632 Update the title position based on the bounding box enclosing
26332633 all the ticklabels and x-axis spine and xlabel...
26342634 """
2635-
26362635 if self ._autotitlepos is not None and not self ._autotitlepos :
26372636 _log .debug ('title position was updated manually, not adjusting' )
26382637 return
@@ -2655,7 +2654,7 @@ def _update_title_position(self, renderer):
26552654 else :
26562655 ax .apply_aspect ()
26572656 axs = axs + [ax ]
2658- top = 0
2657+ top = - np . Inf
26592658 for ax in axs :
26602659 if (ax .xaxis .get_ticks_position () in ['top' , 'unknown' ]
26612660 or ax .xaxis .get_label_position () == 'top' ):
@@ -2664,6 +2663,11 @@ def _update_title_position(self, renderer):
26642663 bb = ax .get_window_extent (renderer )
26652664 if bb is not None :
26662665 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
26672671 if title .get_window_extent (renderer ).ymin < top :
26682672 _ , y = self .transAxes .inverted ().transform ((0 , top ))
26692673 title .set_position ((x , y ))
You can’t perform that action at this time.
0 commit comments