Skip to content

Commit

Permalink
Restore get_renderer function in deprecated tight_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Oct 29, 2022
1 parent 54360f3 commit 2602b90
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/matplotlib/_tight_layout.py
Expand Up @@ -338,3 +338,15 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
rect=(left, bottom, right, top))

return kwargs


def get_renderer(fig):
if fig._cachedRenderer:
return fig._cachedRenderer
else:
canvas = fig.canvas
if canvas and hasattr(canvas, "get_renderer"):
return canvas.get_renderer()
else:
from . import backend_bases
return backend_bases._get_renderer(fig)

0 comments on commit 2602b90

Please sign in to comment.