當前位置: 首頁>>代碼示例>>Python>>正文


Python matplotlib.is_interactive方法代碼示例

本文整理匯總了Python中matplotlib.is_interactive方法的典型用法代碼示例。如果您正苦於以下問題:Python matplotlib.is_interactive方法的具體用法?Python matplotlib.is_interactive怎麽用?Python matplotlib.is_interactive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib的用法示例。


在下文中一共展示了matplotlib.is_interactive方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: destroy

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def destroy(self, *args):
        if _debug: print('FigureManagerGTK.%s' % fn_name())
        if hasattr(self, 'toolbar') and self.toolbar is not None:
            self.toolbar.destroy()
        if hasattr(self, 'vbox'):
            self.vbox.destroy()
        if hasattr(self, 'window'):
            self.window.destroy()
        if hasattr(self, 'canvas'):
            self.canvas.destroy()
        self.__dict__.clear()   #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               gtk.main_level() >= 1:
            gtk.main_quit() 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:18,代碼來源:backend_gtk.py

示例2: connection_info

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [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) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:25,代碼來源:backend_nbagg.py

示例3: __call__

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [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) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:24,代碼來源:backend_nbagg.py

示例4: __init__

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def __init__(self, canvas, num):
        FigureManagerBase.__init__(self, canvas, num)
        title = "Figure %d" % num
        _macosx.FigureManager.__init__(self, canvas, title)
        if rcParams['toolbar']=='toolbar2':
            self.toolbar = NavigationToolbar2Mac(canvas)
        else:
            self.toolbar = None
        if self.toolbar is not None:
            self.toolbar.update()

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolbar != None: self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change)

        if matplotlib.is_interactive():
            self.show() 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:20,代碼來源:backend_macosx.py

示例5: connection_info

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [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) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:25,代碼來源:backend_nbagg.py

示例6: show

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [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) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:24,代碼來源:backend_nbagg.py

示例7: test_scatterplot_w_ioff

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def test_scatterplot_w_ioff(self):
        """Check if scatterplot generates"""

        plt.ioff()
        figs = plot.scatterplot(self.testInst, 'longitude', 'latitude',
                                'slt', [0.0, 24.0])

        axes = figs[0].get_axes()
        assert len(figs) == 1
        assert len(axes) == 3
        assert not mpl.is_interactive() 
開發者ID:pysat,項目名稱:pysat,代碼行數:13,代碼來源:test_ssnl_plot.py

示例8: test_scatterplot_w_ion

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def test_scatterplot_w_ion(self):
        """Check if scatterplot generates and resets to interactive mode"""

        plt.ion()
        figs = plot.scatterplot(self.testInst, 'longitude', 'latitude',
                                'slt', [0.0, 24.0])

        axes = figs[0].get_axes()
        assert len(figs) == 1
        assert len(axes) == 3
        assert mpl.is_interactive() 
開發者ID:pysat,項目名稱:pysat,代碼行數:13,代碼來源:test_ssnl_plot.py

示例9: draw_if_interactive

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
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,代碼行數:9,代碼來源:backend_kivy.py

示例10: __call__

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def __call__(self, **kwargs):
        """Figure realizer

        The Figure class only keeps track of a root panel.  It does
        not contain an actual matplotlib Figure instance.  Whenever a
        figure needs to be created, Figure creates a new matplotlib
        Figure in order to drew/rendered/realized the figure.

        Args:

            **kwargs (dict): Arbitrary Figure-specific keyworded
                arguments that are used to construct the matplotlib
                Figure.

        """
        kwprops = merge_dict(self.kwprops, kwargs)
        style   = kwprops.pop('style')

        with mpl.rc_context():
            mpl.rcdefaults()
            plt.style.use(style)

            imode = mpl.is_interactive()
            if imode:
                plt.ioff()

            fig = plt.figure(**kwprops)
            ax  = newaxes(fig)
            yield fig, ax

            if imode:
                plt.ion() 
開發者ID:liamedeiros,項目名稱:ehtplot,代碼行數:34,代碼來源:figure.py

示例11: draw_if_interactive

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def draw_if_interactive():
    if matplotlib.is_interactive():
        figManager =  Gcf.get_active()
        if figManager is not None:
            figManager.show() 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:backend_tkagg.py

示例12: new_figure_manager_given_figure

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    _focus = windowing.FocusManager()
    window = Tk.Tk()
    window.withdraw()

    if Tk.TkVersion >= 8.5:
        # put a mpl icon on the window rather than the default tk icon. Tkinter
        # doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
        # command which we call directly. Source:
        # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
        icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
        icon_img = Tk.PhotoImage(file=icon_fname)
        try:
            window.tk.call('wm', 'iconphoto', window._w, icon_img)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # log the failure, but carry on
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

    canvas = FigureCanvasTkAgg(figure, master=window)
    figManager = FigureManagerTkAgg(canvas, num, window)
    if matplotlib.is_interactive():
        figManager.show()
    return figManager 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:31,代碼來源:backend_tkagg.py

示例13: draw_if_interactive

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
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:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:backend_webagg.py

示例14: draw_if_interactive

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
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:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:backend_gtk.py

示例15: new_figure_manager_given_figure

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import is_interactive [as 別名]
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    frame = FigureFrameWxAgg(num, figure)
    figmgr = frame.get_figure_manager()
    if matplotlib.is_interactive():
        figmgr.frame.Show()
    return figmgr


#
# agg/wxPython image conversion functions (wxPython >= 2.8)
# 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:16,代碼來源:backend_wxagg.py


注:本文中的matplotlib.is_interactive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。