本文整理汇总了Python中matplotlib._pylab_helpers.Gcf.get_all_fig_managers方法的典型用法代码示例。如果您正苦于以下问题:Python Gcf.get_all_fig_managers方法的具体用法?Python Gcf.get_all_fig_managers怎么用?Python Gcf.get_all_fig_managers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib._pylab_helpers.Gcf
的用法示例。
在下文中一共展示了Gcf.get_all_fig_managers方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_figure_manager_given_figure
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def new_figure_manager_given_figure(num, figure):
"""
Create a new figure manager instance for the given figure.
"""
canvas = FigureCanvasCocoaAgg(figure)
return FigureManagerCocoaAgg(canvas, num)
## Below is the original show() function:
#def show():
# for manager in Gcf.get_all_fig_managers():
# manager.show()
#
## It appears that this backend is unusual in having a separate
## run function invoked for each figure, instead of a single
## mainloop. Presumably there is no blocking at all.
##
## Using the Show class below should cause no difference in
## behavior.
示例2: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(close=None):
"""Show all figures as SVG/PNG payloads sent to the IPython clients.
Parameters
----------
close : bool, optional
If true, a ``plt.close('all')`` call is automatically issued after
sending all the figures. If this is set, the figures will entirely
removed from the internal list of figures.
"""
if close is None:
close = InlineBackend.instance().close_figures
try:
for figure_manager in Gcf.get_all_fig_managers():
display(figure_manager.canvas.figure)
finally:
show._to_draw = []
if close:
matplotlib.pyplot.close('all')
# This flag will be reset by draw_if_interactive when called
示例3: connection_info
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def connection_info():
"""
Return a string showing the figure and connection status for the backend.
This is intended as a diagnostic tool, and not for general use.
"""
result = [
'{fig} - {socket}'.format(
fig=(manager.canvas.figure.get_label()
or "Figure {}".format(manager.num)),
socket=manager.web_sockets)
for manager in Gcf.get_all_fig_managers()
]
if not is_interactive():
result.append('Figures pending show: {}'.format(len(Gcf._activeQue)))
return '\n'.join(result)
# Note: Version 3.2 and 4.x icons
# http://fontawesome.io/3.2.1/icons/
# http://fontawesome.io/
# the `fa fa-xxx` part targets font-awesome 4, (IPython 3.x)
# the icon-xxx targets font awesome 3.21 (IPython 2.x)
示例4: __call__
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def __call__(self, block=None):
from matplotlib._pylab_helpers import Gcf
from matplotlib import is_interactive
managers = Gcf.get_all_fig_managers()
if not managers:
return
interactive = is_interactive()
for manager in managers:
manager.show()
# plt.figure adds an event which puts the figure in focus
# in the activeQue. Disable this behaviour, as it results in
# figures being put as the active figure after they have been
# shown, even in non-interactive mode.
if hasattr(manager, '_cidgcf'):
manager.canvas.mpl_disconnect(manager._cidgcf)
if not interactive and manager in Gcf._activeQue:
Gcf._activeQue.remove(manager)
示例5: connection_info
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def connection_info():
"""
Return a string showing the figure and connection status for
the backend. This is intended as a diagnostic tool, and not for general
use.
"""
from matplotlib._pylab_helpers import Gcf
result = []
for manager in Gcf.get_all_fig_managers():
fig = manager.canvas.figure
result.append('{} - {}'.format((fig.get_label() or
"Figure {0}".format(manager.num)),
manager.web_sockets))
result.append('Figures pending show: {}'.format(len(Gcf._activeQue)))
return '\n'.join(result)
# Note: Version 3.2 and 4.x icons
# http://fontawesome.io/3.2.1/icons/
# http://fontawesome.io/
# the `fa fa-xxx` part targets font-awesome 4, (IPython 3.x)
# the icon-xxx targets font awesome 3.21 (IPython 2.x)
示例6: connection_info
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def connection_info():
"""
Return a string showing the figure and connection status for
the backend. This is intended as a diagnostic tool, and not for general
use.
"""
result = []
for manager in Gcf.get_all_fig_managers():
fig = manager.canvas.figure
result.append('{0} - {0}'.format((fig.get_label() or
"Figure {0}".format(manager.num)),
manager.web_sockets))
if not is_interactive():
result.append('Figures pending show: {0}'.format(len(Gcf._activeQue)))
return '\n'.join(result)
# Note: Version 3.2 and 4.x icons
# http://fontawesome.io/3.2.1/icons/
# http://fontawesome.io/
# the `fa fa-xxx` part targets font-awesome 4, (IPython 3.x)
# the icon-xxx targets font awesome 3.21 (IPython 2.x)
示例7: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(*args, **kwargs):
## TODO: something to do when keyword block==False ?
from matplotlib._pylab_helpers import Gcf
managers = Gcf.get_all_fig_managers()
if not managers:
return
interactive = is_interactive()
for manager in managers:
manager.show()
# plt.figure adds an event which puts the figure in focus
# in the activeQue. Disable this behaviour, as it results in
# figures being put as the active figure after they have been
# shown, even in non-interactive mode.
if hasattr(manager, '_cidgcf'):
manager.canvas.mpl_disconnect(manager._cidgcf)
if not interactive and manager in Gcf._activeQue:
Gcf._activeQue.remove(manager)
示例8: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show():
"""
For image backends - is not required
For GUI backends - show() is usually the last line of a pylab script and
tells the backend that it is time to draw. In interactive mode, this may
be a do nothing func. See the GTK backend for an example of how to handle
interactive versus batch mode
"""
for manager in Gcf.get_all_fig_managers():
# do something to display the GUI
pass
示例9: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(cls, block=None):
"""
Show all figures.
`show` blocks by calling `mainloop` if *block* is ``True``, or if it
is ``None`` and we are neither in IPython's ``%pylab`` mode, nor in
`interactive` mode.
"""
managers = Gcf.get_all_fig_managers()
if not managers:
return
for manager in managers:
# Emits a warning if the backend is non-interactive.
manager.canvas.figure.show()
if cls.mainloop is None:
return
if block is None:
# Hack: Are we in IPython's pylab mode?
from matplotlib import pyplot
try:
# IPython versions >= 0.10 tack the _needmain attribute onto
# pyplot.show, and always set it to False, when in %pylab mode.
ipython_pylab = not pyplot.show._needmain
except AttributeError:
ipython_pylab = False
block = not ipython_pylab and not is_interactive()
# TODO: The above is a hack to get the WebAgg backend working with
# ipython's `%pylab` mode until proper integration is implemented.
if get_backend() == "WebAgg":
block = True
if block:
cls.mainloop()
# This method is the one actually exporting the required methods.
示例10: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(*args, block=None, **kwargs):
if args or kwargs:
cbook.warn_deprecated(
"3.1", message="Passing arguments to show(), other than "
"passing 'block' by keyword, is deprecated %(since)s, and "
"support for it will be removed %(removal)s.")
## TODO: something to do when keyword block==False ?
from matplotlib._pylab_helpers import Gcf
managers = Gcf.get_all_fig_managers()
if not managers:
return
interactive = is_interactive()
for manager in managers:
manager.show()
# plt.figure adds an event which puts the figure in focus
# in the activeQue. Disable this behaviour, as it results in
# figures being put as the active figure after they have been
# shown, even in non-interactive mode.
if hasattr(manager, '_cidgcf'):
manager.canvas.mpl_disconnect(manager._cidgcf)
if not interactive and manager in Gcf._activeQue:
Gcf._activeQue.remove(manager)
示例11: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(*, block=None):
"""
For image backends - is not required.
For GUI backends - show() is usually the last line of a pyplot script and
tells the backend that it is time to draw. In interactive mode, this
should do nothing.
"""
for manager in Gcf.get_all_fig_managers():
# do something to display the GUI
pass
示例12: mainloop
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def mainloop():
managers = Gcf.get_all_fig_managers()
if managers:
managers[0].window.mainloop()
示例13: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(cls, block=None):
"""Show all figures.
`show` blocks by calling `mainloop` if *block* is ``True``, or if it
is ``None`` and we are neither in IPython's ``%pylab`` mode, nor in
`interactive` mode.
"""
managers = Gcf.get_all_fig_managers()
if not managers:
return
for manager in managers:
# Emits a warning if the backend is non-interactive.
manager.canvas.figure.show()
if cls.mainloop is None:
return
if block is None:
# Hack: Are we in IPython's pylab mode?
from matplotlib import pyplot
try:
# IPython versions >= 0.10 tack the _needmain attribute onto
# pyplot.show, and always set it to False, when in %pylab mode.
ipython_pylab = not pyplot.show._needmain
except AttributeError:
ipython_pylab = False
block = not ipython_pylab and not is_interactive()
# TODO: The above is a hack to get the WebAgg backend working with
# ipython's `%pylab` mode until proper integration is implemented.
if get_backend() == "WebAgg":
block = True
if block:
cls.mainloop()
# This method is the one actually exporting the required methods.
示例14: show
# 需要导入模块: from matplotlib._pylab_helpers import Gcf [as 别名]
# 或者: from matplotlib._pylab_helpers.Gcf import get_all_fig_managers [as 别名]
def show(block=None):
"""
For image backends - is not required.
For GUI backends - show() is usually the last line of a pyplot script and
tells the backend that it is time to draw. In interactive mode, this
should do nothing.
"""
for manager in Gcf.get_all_fig_managers():
# do something to display the GUI
pass