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
| 2429 | |
| 2430 | @_docstring.interpd |
| 2431 | class 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 |
no outgoing calls
searching dependent graphs…