MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_constrained_layout_pads

Method get_constrained_layout_pads

lib/matplotlib/figure.py:2978–3007  ·  view source on GitHub ↗

Get padding for ``constrained_layout``. Returns a list of ``w_pad, h_pad`` in inches and ``wspace`` and ``hspace`` as fractions of the subplot. All values are None if ``constrained_layout`` is not used. See :ref:`constrainedlayout_guide`. Parameter

(self, relative=False)

Source from the content-addressed store, hash-verified

2976 @_api.deprecated("3.6", alternative="fig.get_layout_engine().get()",
2977 pending=True)
2978 def get_constrained_layout_pads(self, relative=False):
2979 """
2980 Get padding for ``constrained_layout``.
2981
2982 Returns a list of ``w_pad, h_pad`` in inches and
2983 ``wspace`` and ``hspace`` as fractions of the subplot.
2984 All values are None if ``constrained_layout`` is not used.
2985
2986 See :ref:`constrainedlayout_guide`.
2987
2988 Parameters
2989 ----------
2990 relative : bool
2991 If `True`, then convert from inches to figure relative.
2992 """
2993 if not isinstance(self.get_layout_engine(), ConstrainedLayoutEngine):
2994 return None, None, None, None
2995 info = self.get_layout_engine().get()
2996 w_pad = info['w_pad']
2997 h_pad = info['h_pad']
2998 wspace = info['wspace']
2999 hspace = info['hspace']
3000
3001 if relative and (w_pad is not None or h_pad is not None):
3002 renderer = self._get_renderer()
3003 dpi = renderer.dpi
3004 w_pad = w_pad * dpi / renderer.width
3005 h_pad = h_pad * dpi / renderer.height
3006
3007 return w_pad, h_pad, wspace, hspace
3008
3009 def _set_base_canvas(self):
3010 """

Calls 3

get_layout_engineMethod · 0.95
_get_rendererMethod · 0.95
getMethod · 0.45

Tested by 1