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


Python axes.SubplotBase方法代碼示例

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


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

示例1: colorbar

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
        """
        Create a colorbar for a ScalarMappable instance, *mappable*.

        Documentation for the pylab thin wrapper:
        %(colorbar_doc)s
        """
        if ax is None:
            ax = self.gca()

        # Store the value of gca so that we can set it back later on.
        current_ax = self.gca()

        if cax is None:
            if use_gridspec and isinstance(ax, SubplotBase):
                cax, kw = cbar.make_axes_gridspec(ax, **kw)
            else:
                cax, kw = cbar.make_axes(ax, **kw)
        cax.hold(True)
        cb = cbar.colorbar_factory(cax, mappable, **kw)

        self.sca(current_ax)
        return cb 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:25,代碼來源:figure.py

示例2: update

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def update(self, **kwargs):
        """
        Update the current values.  If any kwarg is None, default to
        the current value, if set, otherwise to rc.
        """

        for k, v in kwargs.iteritems():
            if k in self._AllowedKeys:
                setattr(self, k, v)
            else:
                raise AttributeError("%s is unknown keyword" % (k,))


        from matplotlib import _pylab_helpers
        from matplotlib.axes import SubplotBase
        for figmanager in _pylab_helpers.Gcf.figs.itervalues():
            for ax in figmanager.canvas.figure.axes:
                # copied from Figure.subplots_adjust
                if not isinstance(ax, SubplotBase):
                    # Check if sharing a subplots axis
                    if ax._sharex is not None and isinstance(ax._sharex, SubplotBase):
                        if ax._sharex.get_subplotspec().get_gridspec() == self:
                            ax._sharex.update_params()
                            ax.set_position(ax._sharex.figbox)
                    elif ax._sharey is not None and isinstance(ax._sharey,SubplotBase):
                        if ax._sharey.get_subplotspec().get_gridspec() == self:
                            ax._sharey.update_params()
                            ax.set_position(ax._sharey.figbox)
                else:
                    ss = ax.get_subplotspec().get_topmost_subplotspec()
                    if ss.get_gridspec() == self:
                        ax.update_params()
                        ax.set_position(ax.figbox) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:35,代碼來源:gridspec.py

示例3: subplots_adjust

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def subplots_adjust(self, *args, **kwargs):
        """
        Call signature::

          subplots_adjust(left=None, bottom=None, right=None, top=None,
                              wspace=None, hspace=None)

        Update the :class:`SubplotParams` with *kwargs* (defaulting to rc when
        *None*) and update the subplot locations

        """
        self.subplotpars.update(*args, **kwargs)
        for ax in self.axes:
            if not isinstance(ax, SubplotBase):
                # Check if sharing a subplots axis
                if (ax._sharex is not None and
                    isinstance(ax._sharex, SubplotBase)):
                    ax._sharex.update_params()
                    ax.set_position(ax._sharex.figbox)
                elif (ax._sharey is not None and
                      isinstance(ax._sharey, SubplotBase)):
                    ax._sharey.update_params()
                    ax.set_position(ax._sharey.figbox)
            else:
                ax.update_params()
                ax.set_position(ax.figbox) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:28,代碼來源:figure.py

示例4: _get_new_axes

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def _get_new_axes(self, **kwargs):
        axes = self._axes

        axes_class = kwargs.pop("axes_class", None)

        if axes_class is None:
            if isinstance(axes, SubplotBase):
                axes_class = axes._axes_class
            else:
                axes_class = type(axes)

        ax = axes_class(axes.get_figure(),
                        axes.get_position(original=True), **kwargs)

        return ax 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:17,代碼來源:axes_divider.py

示例5: update

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def update(self, **kwargs):
        """
        Update the current values.  If any kwarg is None, default to
        the current value, if set, otherwise to rc.
        """

        for k, v in six.iteritems(kwargs):
            if k in self._AllowedKeys:
                setattr(self, k, v)
            else:
                raise AttributeError("%s is unknown keyword" % (k,))


        from matplotlib import _pylab_helpers
        from matplotlib.axes import SubplotBase
        for figmanager in six.itervalues(_pylab_helpers.Gcf.figs):
            for ax in figmanager.canvas.figure.axes:
                # copied from Figure.subplots_adjust
                if not isinstance(ax, SubplotBase):
                    # Check if sharing a subplots axis
                    if ax._sharex is not None and isinstance(ax._sharex, SubplotBase):
                        if ax._sharex.get_subplotspec().get_gridspec() == self:
                            ax._sharex.update_params()
                            ax.set_position(ax._sharex.figbox)
                    elif ax._sharey is not None and isinstance(ax._sharey,SubplotBase):
                        if ax._sharey.get_subplotspec().get_gridspec() == self:
                            ax._sharey.update_params()
                            ax.set_position(ax._sharey.figbox)
                else:
                    ss = ax.get_subplotspec().get_topmost_subplotspec()
                    if ss.get_gridspec() == self:
                        ax.update_params()
                        ax.set_position(ax.figbox) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:35,代碼來源:gridspec.py

示例6: colorbar

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
        """
        Create a colorbar for a ScalarMappable instance, *mappable*.

        Documentation for the pyplot thin wrapper:
        %(colorbar_doc)s
        """
        if ax is None:
            ax = self.gca()

        # Store the value of gca so that we can set it back later on.
        current_ax = self.gca()

        if cax is None:
            if use_gridspec and isinstance(ax, SubplotBase)  \
                     and (not self.get_constrained_layout()):
                cax, kw = cbar.make_axes_gridspec(ax, **kw)
            else:
                cax, kw = cbar.make_axes(ax, **kw)

        # need to remove kws that cannot be passed to Colorbar
        NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
                             'panchor']
        cb_kw = {k: v for k, v in kw.items() if k not in NON_COLORBAR_KEYS}
        cb = cbar.colorbar_factory(cax, mappable, **cb_kw)

        self.sca(current_ax)
        self.stale = True
        return cb 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:31,代碼來源:figure.py

示例7: subplots_adjust

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
                        wspace=None, hspace=None):
        """
        Update the :class:`SubplotParams` with *kwargs* (defaulting to rc when
        *None*) and update the subplot locations.

        """
        if self.get_constrained_layout():
            self.set_constrained_layout(False)
            warnings.warn("This figure was using constrained_layout==True, "
                          "but that is incompatible with subplots_adjust and "
                          "or tight_layout: setting "
                          "constrained_layout==False. ")
        self.subplotpars.update(left, bottom, right, top, wspace, hspace)
        for ax in self.axes:
            if not isinstance(ax, SubplotBase):
                # Check if sharing a subplots axis
                if isinstance(ax._sharex, SubplotBase):
                    ax._sharex.update_params()
                    ax.set_position(ax._sharex.figbox)
                elif isinstance(ax._sharey, SubplotBase):
                    ax._sharey.update_params()
                    ax.set_position(ax._sharey.figbox)
            else:
                ax.update_params()
                ax.set_position(ax.figbox)
        self.stale = True 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:29,代碼來源:figure.py

示例8: _get_new_axes

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def _get_new_axes(self, *, axes_class=None, **kwargs):
        axes = self._axes
        if axes_class is None:
            if isinstance(axes, SubplotBase):
                axes_class = axes._axes_class
            else:
                axes_class = type(axes)
        return axes_class(axes.get_figure(), axes.get_position(original=True),
                          **kwargs) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:11,代碼來源:axes_divider.py

示例9: test_create_axes_grid

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_create_axes_grid(nodiag):
    parameters = ['mass1', 'mass2', 'tc']
    if nodiag:
        combinations = itertools.combinations
        ndim = len(parameters) - 1
    else:
        combinations = itertools.combinations_with_replacement
        ndim = len(parameters)

    # create figure
    fig, axes = scatter_histograms.create_axes_grid(
        parameters, no_diagonals=nodiag)

    # test
    assert isinstance(fig, Figure)
    for p1, p2 in combinations(parameters, 2):
        ax, row, col = axes[p1, p2]
        print(row, col, p1, p2)
        print(ax.get_xlabel(), ax.get_ylabel())
        assert isinstance(ax, SubplotBase)
        if row + 1 == ndim:
            assert ax.get_xlabel() == p1
        else:
            assert ax.get_xlabel() == ''
        if col == 0:
            assert ax.get_ylabel() == p2
        else:
            assert ax.get_ylabel() == '' 
開發者ID:gwastro,項目名稱:gwin,代碼行數:30,代碼來源:test_results.py

示例10: subplots_adjust

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
                        wspace=None, hspace=None):
        """
        Update the :class:`SubplotParams` with *kwargs* (defaulting to rc when
        *None*) and update the subplot locations.

        """
        if self.get_constrained_layout():
            self.set_constrained_layout(False)
            cbook._warn_external("This figure was using "
                                 "constrained_layout==True, but that is "
                                 "incompatible with subplots_adjust and or "
                                 "tight_layout: setting "
                                 "constrained_layout==False. ")
        self.subplotpars.update(left, bottom, right, top, wspace, hspace)
        for ax in self.axes:
            if not isinstance(ax, SubplotBase):
                # Check if sharing a subplots axis
                if isinstance(ax._sharex, SubplotBase):
                    ax._sharex.update_params()
                    ax.set_position(ax._sharex.figbox)
                elif isinstance(ax._sharey, SubplotBase):
                    ax._sharey.update_params()
                    ax.set_position(ax._sharey.figbox)
            else:
                ax.update_params()
                ax.set_position(ax.figbox)
        self.stale = True 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:30,代碼來源:figure.py

示例11: test_plot_free_energy_1d

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_plot_free_energy_1d(self):
        ax = plot_free_energy(data, n_samples=10000, pi=np.array(n*[.5]),
                              xlabel='x', ylabel='y')

        assert isinstance(ax, SubplotBase) 
開發者ID:msmbuilder,項目名稱:msmexplorer,代碼行數:7,代碼來源:test_projection_plot.py

示例12: test_plot_free_energy_2d

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_plot_free_energy_2d(self):
        ax = plot_free_energy(data, obs=(0, 1), n_samples=10000,
                              pi=np.array(n*[.5]), xlabel='x', ylabel='y',
                              clabel=True)

        assert isinstance(ax, SubplotBase) 
開發者ID:msmbuilder,項目名稱:msmexplorer,代碼行數:8,代碼來源:test_projection_plot.py

示例13: test_plot_decomp_grid

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_plot_decomp_grid(self):
        from msmbuilder.decomposition import tICA

        tica = tICA(n_components=2).fit([data])
        ax = plot_decomp_grid(tica, xlim=(0., 1.), ylim=(0., 1.))

        assert isinstance(ax, SubplotBase) 
開發者ID:msmbuilder,項目名稱:msmexplorer,代碼行數:9,代碼來源:test_projection_plot.py

示例14: test_plot_msm_network

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_plot_msm_network(self):
        ax = plot_msm_network(msm)

        assert isinstance(ax, SubplotBase) 
開發者ID:msmbuilder,項目名稱:msmexplorer,代碼行數:6,代碼來源:test_msm_plot.py

示例15: test_plot_timescales_msm

# 需要導入模塊: from matplotlib import axes [as 別名]
# 或者: from matplotlib.axes import SubplotBase [as 別名]
def test_plot_timescales_msm(self):
        ax = plot_timescales(msm, n_timescales=3, xlabel='x', ylabel='y')

        assert isinstance(ax, SubplotBase) 
開發者ID:msmbuilder,項目名稱:msmexplorer,代碼行數:6,代碼來源:test_msm_plot.py


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