当前位置: 首页>>代码示例>>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;未经允许,请勿转载。