MCPcopy
hub / github.com/matplotlib/matplotlib / get_figure

Method get_figure

lib/matplotlib/figure.py:232–269  ·  view source on GitHub ↗

Return the `.Figure` or `.SubFigure` instance the (Sub)Figure belongs to. Parameters ---------- root : bool, default=True If False, return the (Sub)Figure this artist is on. If True, return the root Figure for a nested tree of SubFigures.

(self, root=None)

Source from the content-addressed store, hash-verified

230 *self.subfigs]
231
232 def get_figure(self, root=None):
233 """
234 Return the `.Figure` or `.SubFigure` instance the (Sub)Figure belongs to.
235
236 Parameters
237 ----------
238 root : bool, default=True
239 If False, return the (Sub)Figure this artist is on. If True,
240 return the root Figure for a nested tree of SubFigures.
241
242 .. deprecated:: 3.10
243
244 From version 3.12 *root* will default to False.
245 """
246 if self._root_figure is self:
247 # Top level Figure
248 return self
249
250 if self._parent is self._root_figure:
251 # Return early to prevent the deprecation warning when *root* does not
252 # matter
253 return self._parent
254
255 if root is None:
256 # When deprecation expires, consider removing the docstring and just
257 # inheriting the one from Artist.
258 message = ('From Matplotlib 3.12 SubFigure.get_figure will by default '
259 'return the direct parent figure, which may be a SubFigure. '
260 'To suppress this warning, pass the root parameter. Pass '
261 '`True` to maintain the old behavior and `False` to opt-in to '
262 'the future behavior.')
263 _api.warn_deprecated('3.10', message=message)
264 root = True
265
266 if root:
267 return self._root_figure
268
269 return self._parent
270
271 def set_figure(self, fig):
272 """

Callers 6

get_tightbboxMethod · 0.95
_stale_figure_callbackFunction · 0.45
add_axesMethod · 0.45
add_subplotMethod · 0.45
colorbarMethod · 0.45
drawMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected