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

Class Figure

lib/matplotlib/figure.py:2431–3671  ·  view source on GitHub ↗

The top level container for all the plot elements. See `matplotlib.figure` for an index of class methods. Attributes ---------- patch The `.Rectangle` instance representing the figure background patch. suppressComposite For multiple images, the figure will

Source from the content-addressed store, hash-verified

2429
2430@_docstring.interpd
2431class Figure(FigureBase):
2432 """
2433 The top level container for all the plot elements.
2434
2435 See `matplotlib.figure` for an index of class methods.
2436
2437 Attributes
2438 ----------
2439 patch
2440 The `.Rectangle` instance representing the figure background patch.
2441
2442 suppressComposite
2443 For multiple images, the figure will make composite images
2444 depending on the renderer option_image_nocomposite function. If
2445 *suppressComposite* is a boolean, this will override the renderer.
2446 """
2447
2448 # we want to cache the fonts and mathtext at a global level so that when
2449 # multiple figures are created we can reuse them. This helps with a bug on
2450 # windows where the creation of too many figures leads to too many open
2451 # file handles and improves the performance of parsing mathtext. However,
2452 # these global caches are not thread safe. The solution here is to let the
2453 # Figure acquire a shared lock at the start of the draw, and release it when it
2454 # is done. This allows multiple renderers to share the cached fonts and
2455 # parsed text, but only one figure can draw at a time and so the font cache
2456 # and mathtext cache are used by only one renderer at a time.
2457
2458 _render_lock = threading.RLock()
2459
2460 def __str__(self):
2461 return "Figure(%gx%g)" % tuple(self.bbox.size)
2462
2463 def __repr__(self):
2464 return "<{clsname} size {h:g}x{w:g} with {naxes} Axes>".format(
2465 clsname=self.__class__.__name__,
2466 h=self.bbox.size[0], w=self.bbox.size[1],
2467 naxes=len(self.axes),
2468 )
2469
2470 def __init__(self,
2471 figsize=None,
2472 dpi=None,
2473 *,
2474 facecolor=None,
2475 edgecolor=None,
2476 linewidth=0.0,
2477 frameon=None,
2478 subplotpars=None, # rc figure.subplot.*
2479 tight_layout=None, # rc figure.autolayout
2480 constrained_layout=None, # rc figure.constrained_layout.use
2481 layout=None,
2482 **kwargs
2483 ):
2484 """
2485 Parameters
2486 ----------
2487 figsize : (float, float) or (float, float, str), default: :rc:`figure.figsize`
2488 The figure dimensions. This can be

Callers 15

imsaveFunction · 0.90
thumbnailFunction · 0.90
_repr_png_Method · 0.90
__init__Method · 0.90
configure_subplotsMethod · 0.90
test_unicode_wonFunction · 0.90
test_clip_path_ids_reuseFunction · 0.90
test_drawFunction · 0.90
test_empty_lineFunction · 0.90
test_twin_unitsFunction · 0.90
test_subclass_clear_claFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_unicode_wonFunction · 0.72
test_clip_path_ids_reuseFunction · 0.72
test_drawFunction · 0.72
test_empty_lineFunction · 0.72
test_twin_unitsFunction · 0.72
test_subclass_clear_claFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…