2626from matplotlib .artist import (
2727 Artist , allow_rasterization , _finalize_rasterization )
2828from matplotlib .backend_bases import (
29- FigureCanvasBase , NonGuiException , MouseButton , _no_output_draw )
29+ FigureCanvasBase , NonGuiException , MouseButton , _get_renderer )
3030import matplotlib ._api as _api
3131import matplotlib .cbook as cbook
3232import matplotlib .colorbar as cbar
@@ -2744,7 +2744,9 @@ def draw_no_output(self):
27442744 Draw the figure with no output. Useful to get the final size of
27452745 artists that require a draw before their size is known (e.g. text).
27462746 """
2747- _no_output_draw (self )
2747+ renderer = _get_renderer (self )
2748+ with renderer ._draw_disabled ():
2749+ self .draw (renderer )
27482750
27492751 def draw_artist (self , a ):
27502752 """
@@ -3022,7 +3024,6 @@ def execute_constrained_layout(self, renderer=None):
30223024 """
30233025
30243026 from matplotlib ._constrained_layout import do_constrained_layout
3025- from matplotlib .tight_layout import get_renderer
30263027
30273028 _log .debug ('Executing constrainedlayout' )
30283029 if self ._layoutgrid is None :
@@ -3040,7 +3041,7 @@ def execute_constrained_layout(self, renderer=None):
30403041 w_pad = w_pad / width
30413042 h_pad = h_pad / height
30423043 if renderer is None :
3043- renderer = get_renderer (fig )
3044+ renderer = _get_renderer (fig )
30443045 do_constrained_layout (fig , renderer , h_pad , w_pad , hspace , wspace )
30453046
30463047 def tight_layout (self , * , pad = 1.08 , h_pad = None , w_pad = None , rect = None ):
@@ -3070,15 +3071,15 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
30703071 """
30713072
30723073 from .tight_layout import (
3073- get_renderer , get_subplotspec_list , get_tight_layout_figure )
3074+ get_subplotspec_list , get_tight_layout_figure )
30743075 from contextlib import suppress
30753076 subplotspec_list = get_subplotspec_list (self .axes )
30763077 if None in subplotspec_list :
30773078 _api .warn_external ("This figure includes Axes that are not "
30783079 "compatible with tight_layout, so results "
30793080 "might be incorrect." )
30803081
3081- renderer = get_renderer (self )
3082+ renderer = _get_renderer (self )
30823083 ctx = (renderer ._draw_disabled ()
30833084 if hasattr (renderer , '_draw_disabled' )
30843085 else suppress ())
0 commit comments