• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _pylab_helpers.Gcf类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib._pylab_helpers.Gcf的典型用法代码示例。如果您正苦于以下问题:Python Gcf类的具体用法?Python Gcf怎么用?Python Gcf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Gcf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: show

def show():
    """ Show all the figures """
    for manager in Gcf.get_all_fig_managers():
        manager.window.show()
    figManager =  Gcf.get_active()
    if figManager != None:
        figManager.canvas.draw()
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:7,代码来源:backend_sv4agg.py


示例2: show

def show(block=True, layout="", open_plot=True):
    """
    This show is typically called via pyplot.show.
    In general usage a script will have a sequence of figure creation followed by a pyplot.show which
    effectively blocks and leaves the figures open for the user.
    We suspect this blocking is because the mainloop thread of the GUI is not setDaemon and thus halts
    python termination.
    To simulate this we create a non daemon dummy thread and instruct the user to use Ctrl-C to finish...
    """
    Gcf.get_active().canvas.draw()
    # update the current figure
    # open the browser with the current active figure shown...

    # if not _test and open_plot:
    #     try:
    #         webbrowser.open_new_tab(h5m.url + "/" + str(layout))
    #     except:
    #         print "Failed to open figure page in your browser. Please browse to " + h5m.url + "/" + str(Gcf.get_active().canvas.figure.number)

    if block and not _test:
        print "Showing figures. Hit Ctrl-C to finish script and close figures..."
        try:
            while True:
                time.sleep(1)
        except KeyboardInterrupt:
            if not _quiet:
                print "Shutting down..."
开发者ID:brefsdal,项目名称:peerplot,代码行数:27,代码来源:backend_h5canvas.py


示例3: show

def show(close=None, block=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.
    block : Not used.
      The `block` parameter is a Matplotlib experimental parameter.
      We accept it in the function signature for compatibility with other
      backends.
    """
    if close is None:
        close = InlineBackend.instance().close_figures
    try:
        for figure_manager in Gcf.get_all_fig_managers():
            display(
                figure_manager.canvas.figure,
                metadata=_fetch_figure_metadata(figure_manager.canvas.figure)
            )
    finally:
        show._to_draw = []
        # only call close('all') if any to close
        # close triggers gc.collect, which can be slow
        if close and Gcf.get_all_fig_managers():
            matplotlib.pyplot.close('all')
开发者ID:ipython,项目名称:ipykernel,代码行数:28,代码来源:backend_inline.py


示例4: _widgetclosed

 def _widgetclosed( self ):
     if self.window._destroying: return
     self.window._destroying = True
     try:
         Gcf.destroy(self.num)
     except AttributeError:
         pass
开发者ID:qsnake,项目名称:matplotlib,代码行数:7,代码来源:backend_qt4.py


示例5: fig_visibility_changed

 def fig_visibility_changed(self):
     """
     Make a notification in the global figure manager that
     plot visibility was changed. This method is added to this
     class so that it can be wrapped in a QAppThreadCall.
     """
     Gcf.figure_visibility_changed(self.num)
开发者ID:samueljackson92,项目名称:mantid,代码行数:7,代码来源:figuremanager.py


示例6: _widgetclosed

 def _widgetclosed(self):
     if self.window._destroying:
         return
     self.window._destroying = True
     map(self.canvas.mpl_disconnect, self._cids)
     try:
         Gcf.destroy(self.num)
     except AttributeError:
         pass
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:figuremanager.py


示例7: set_window_title

    def set_window_title(self, title):
        self.window.setWindowTitle(title)
        # We need to add a call to the figure manager here to call
        # notify methods when a figure is renamed, to update our
        # plot list.
        Gcf.figure_title_changed(self.num)

        # For the workbench we also keep the label in sync, this is
        # to allow getting a handle as plt.figure('Figure Name')
        self.canvas.figure.set_label(title)
开发者ID:samueljackson92,项目名称:mantid,代码行数:10,代码来源:figuremanager.py


示例8: savefig

    def savefig(self, figure=None, **kwargs):
        """
        Saves a :class:`~matplotlib.figure.Figure` to this file as a new page.

        Any other keyword arguments are passed to
        :meth:`~matplotlib.figure.Figure.savefig`.

        Parameters
        ----------

        figure : :class:`~matplotlib.figure.Figure` or int, optional
            Specifies what figure is saved to file. If not specified, the
            active figure is saved. If a :class:`~matplotlib.figure.Figure`
            instance is provided, this figure is saved. If an int is specified,
            the figure instance to save is looked up by number.
        """
        if not isinstance(figure, Figure):
            if figure is None:
                manager = Gcf.get_active()
            else:
                manager = Gcf.get_fig_manager(figure)
            if manager is None:
                raise ValueError("No figure {}".format(figure))
            figure = manager.canvas.figure

        try:
            orig_canvas = figure.canvas
            figure.canvas = FigureCanvasPgf(figure)

            width, height = figure.get_size_inches()
            if self._n_figures == 0:
                self._write_header(width, height)
            else:
                # \pdfpagewidth and \pdfpageheight exist on pdftex, xetex, and
                # luatex<0.85; they were renamed to \pagewidth and \pageheight
                # on luatex>=0.85.
                self._file.write(
                    br'\newpage'
                    br'\ifdefined\pdfpagewidth\pdfpagewidth'
                    br'\else\pagewidth\fi=%ain'
                    br'\ifdefined\pdfpageheight\pdfpageheight'
                    br'\else\pageheight\fi=%ain'
                    b'%%\n' % (width, height)
                )

            figure.savefig(self._file, format="pgf", **kwargs)
            self._n_figures += 1
        finally:
            figure.canvas = orig_canvas
开发者ID:endolith,项目名称:matplotlib,代码行数:49,代码来源:backend_pgf.py


示例9: draw_if_interactive

def draw_if_interactive():
    '''Handle whether or not the backend is in interactive mode or not.
    '''
    if matplotlib.is_interactive():
        figManager = Gcf.get_active()
        if figManager:
            figManager.canvas.draw_idle()
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:7,代码来源:backend_kivy.py


示例10: show

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
    """
    global plotnumber
    global lastfile
    global filename_template
    global outdir

    for manager in Gcf.get_all_fig_managers():
        # do something to display the GUI
        pass
    lastfile = filename_template % plotnumber
    outpath = os.path.join(outdir, lastfile)
    if not os.path.exists(outdir):
        raise IOError("No such directory %s " % outdir)

    if setdpi:
        matplotlib.pyplot.savefig(outpath, dpi=setdpi)
    else:
        matplotlib.pyplot.savefig(outpath)
    plotnumber = plotnumber + 1
    return plotnumber - 1
开发者ID:barryrowlingson,项目名称:pytml,代码行数:27,代码来源:backend_autosave.py


示例11: pastefig

def pastefig(*figs):
    """Paste one or more figures into the console workspace.

    If no arguments are given, all available figures are pasted.  If the
    argument list contains references to invalid figures, a warning is printed
    but the function continues pasting further figures.

    Parameters
    ----------
    figs : tuple
      A tuple that can contain any mixture of integers and figure objects.
    """
    if not figs:
        show(close=False)
    else:
        fig_managers = Gcf.get_all_fig_managers()
        fig_index = dict( [(fm.canvas.figure, fm.canvas) for fm in fig_managers]
           + [ (fm.canvas.figure.number, fm.canvas) for fm in fig_managers] )

        for fig in figs:
            canvas = fig_index.get(fig)
            if canvas is None:
                print('Warning: figure %s not available.' % fig)
            else:
                send_svg_canvas(canvas)
开发者ID:08saikiranreddy,项目名称:ipython,代码行数:25,代码来源:backend_inline.py


示例12: getfigs

def getfigs(*fig_nums):
    """Get a list of matplotlib figures by figure numbers.

    If no arguments are given, all available figures are returned.  If the
    argument list contains references to invalid figures, a warning is printed
    but the function continues pasting further figures.

    Parameters
    ----------
    figs : tuple
        A tuple of ints giving the figure numbers of the figures to return.
    """
    from matplotlib._pylab_helpers import Gcf
    if not fig_nums:
        fig_managers = Gcf.get_all_fig_managers()
        return [fm.canvas.figure for fm in fig_managers]
    else:
        figs = []
        for num in fig_nums:
            f = Gcf.figs.get(num)
            if f is None:
                print('Warning: figure %s not available.' % num)
            else:
                figs.append(f.canvas.figure)
        return figs
开发者ID:BhuvanRamK,项目名称:ipython,代码行数:25,代码来源:pylabtools.py


示例13: open

 def open(self, fignum):
     self.fignum = int(fignum)
     manager = Gcf.get_fig_manager(self.fignum)
     manager.add_web_socket(self)
     _, _, w, h = manager.canvas.figure.bbox.bounds
     manager.resize(w, h)
     self.on_message('{"type":"refresh"}')
开发者ID:AdamHeck,项目名称:matplotlib,代码行数:7,代码来源:backend_webagg.py


示例14: __call__

    def __call__(self, **kwargs):
        managers = Gcf.get_all_fig_managers()
        if not managers:
            return

        for manager in managers:
            manager.show(**kwargs)
开发者ID:yuchuangu85,项目名称:intellij-community,代码行数:7,代码来源:backend_interagg.py


示例15: show

    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)
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:28,代码来源:backend_nbagg.py


示例16: get

 def get(self, fignum, fmt):
     fignum = int(fignum)
     manager = Gcf.get_fig_manager(fignum)
     self.set_header(
         'Content-Type', mimetypes.types_map.get(fmt, 'binary'))
     buff = BytesIO()
     manager.canvas.figure.savefig(buff, format=fmt)
     self.write(buff.getvalue())
开发者ID:QuLogic,项目名称:matplotlib,代码行数:8,代码来源:backend_webagg.py


示例17: destroy

 def destroy(self, *args):
     if Gcf.get_num_fig_managers()==0 and not matplotlib.is_interactive():
         if self.window is not None:
             self.window.quit()
     if self.window is not None:
         #self.toolbar.destroy()
         self.window.destroy()
         self.window = None
开发者ID:dhomeier,项目名称:matplotlib-py3,代码行数:8,代码来源:backend_tkagg.py


示例18: draw_if_interactive

def draw_if_interactive():
    """
    Is called after every pylab drawing command
    """
    if matplotlib.is_interactive():
        figManager =  Gcf.get_active()
        if figManager is not None:
            figManager.canvas.draw_idle()
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:8,代码来源:backend_gtk.py


示例19: new_figure_manager_given_figure

 def new_figure_manager_given_figure(num, figure):
     canvas = FigureCanvasNbAgg(figure)
     manager = FigureManagerNbAgg(canvas, num)
     if is_interactive():
         manager.show()
         figure.canvas.draw_idle()
     canvas.mpl_connect('close_event', lambda event: Gcf.destroy(num))
     return manager
开发者ID:endolith,项目名称:matplotlib,代码行数:8,代码来源:backend_nbagg.py


示例20: ignore

	def ignore(self, event):
		if event.inaxes != self.ax:
			return True
		elif 'zoom' in Gcf.get_active().toolbar.mode:
			return True
		elif event.name == 'pick_event':
			return True
		return False
开发者ID:xlougeo,项目名称:aimbat,代码行数:8,代码来源:plotutils.py



注:本文中的matplotlib._pylab_helpers.Gcf类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python animation.FuncAnimation类代码示例发布时间:2022-05-27
下一篇:
Python _png.write_png函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap