MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / close

Function close

site-packages/matplotlib/pyplot.py:621–660  ·  view source on GitHub ↗

Close a figure window. Parameters ---------- fig : None or int or str or `.Figure` The figure to close. There are a number of ways to specify this: - *None*: the current figure - `.Figure`: the given `.Figure` instance - ``int``: a figure number

(fig=None)

Source from the content-addressed store, hash-verified

619
620
621def close(fig=None):
622 """
623 Close a figure window.
624
625 Parameters
626 ----------
627 fig : None or int or str or `.Figure`
628 The figure to close. There are a number of ways to specify this:
629
630 - *None*: the current figure
631 - `.Figure`: the given `.Figure` instance
632 - ``int``: a figure number
633 - ``str``: a figure name
634 - 'all': all figures
635
636 """
637 if fig is None:
638 figManager = _pylab_helpers.Gcf.get_active()
639 if figManager is None:
640 return
641 else:
642 _pylab_helpers.Gcf.destroy(figManager.num)
643 elif fig == 'all':
644 _pylab_helpers.Gcf.destroy_all()
645 elif isinstance(fig, int):
646 _pylab_helpers.Gcf.destroy(fig)
647 elif hasattr(fig, 'int'):
648 # if we are dealing with a type UUID, we
649 # can use its integer representation
650 _pylab_helpers.Gcf.destroy(fig.int)
651 elif isinstance(fig, str):
652 allLabels = get_figlabels()
653 if fig in allLabels:
654 num = get_fignums()[allLabels.index(fig)]
655 _pylab_helpers.Gcf.destroy(num)
656 elif isinstance(fig, Figure):
657 _pylab_helpers.Gcf.destroy_fig(fig)
658 else:
659 raise TypeError("close() argument must be a Figure, an int, a string, "
660 "or None, not '%s'")
661
662
663def clf():

Callers 1

switch_backendFunction · 0.70

Calls 8

hasattrFunction · 0.85
get_figlabelsFunction · 0.85
get_fignumsFunction · 0.85
destroy_allMethod · 0.80
destroy_figMethod · 0.80
get_activeMethod · 0.45
destroyMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected