当前位置: 首页>>代码示例>>Python>>正文


Python axes.Axes方法代码示例

本文整理汇总了Python中matplotlib.axes.Axes方法的典型用法代码示例。如果您正苦于以下问题:Python axes.Axes方法的具体用法?Python axes.Axes怎么用?Python axes.Axes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.axes的用法示例。


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

示例1: _check_legend_labels

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _check_legend_labels(self, axes, labels=None, visible=True):
        """
        Check each axes has expected legend labels

        Parameters
        ----------
        axes : matplotlib Axes object, or its list-like
        labels : list-like
            expected legend labels
        visible : bool
            expected legend visibility. labels are checked only when visible is
            True
        """

        if visible and (labels is None):
            raise ValueError('labels must be specified when visible is True')
        axes = self._flatten_visible(axes)
        for ax in axes:
            if visible:
                assert ax.get_legend() is not None
                self._check_text_labels(ax.get_legend().get_texts(), labels)
            else:
                assert ax.get_legend() is None 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:common.py

示例2: _check_data

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _check_data(self, xp, rs):
        """
        Check each axes has identical lines

        Parameters
        ----------
        xp : matplotlib Axes object
        rs : matplotlib Axes object
        """
        xp_lines = xp.get_lines()
        rs_lines = rs.get_lines()

        def check_line(xpl, rsl):
            xpdata = xpl.get_xydata()
            rsdata = rsl.get_xydata()
            tm.assert_almost_equal(xpdata, rsdata)

        assert len(xp_lines) == len(rs_lines)
        [check_line(xpl, rsl) for xpl, rsl in zip(xp_lines, rs_lines)]
        tm.close() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:22,代码来源:common.py

示例3: _check_ax_scales

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _check_ax_scales(self, axes, xaxis='linear', yaxis='linear'):
        """
        Check each axes has expected scales

        Parameters
        ----------
        axes : matplotlib Axes object, or its list-like
        xaxis : {'linear', 'log'}
            expected xaxis scale
        yaxis :  {'linear', 'log'}
            expected yaxis scale
        """
        axes = self._flatten_visible(axes)
        for ax in axes:
            assert ax.xaxis.get_scale() == xaxis
            assert ax.yaxis.get_scale() == yaxis 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:common.py

示例4: _gci

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _gci(self):
        """
        helper for :func:`~matplotlib.pyplot.gci`;
        do not use elsewhere.
        """
        # Look first for an image in the current Axes:
        cax = self._axstack.current_key_axes()[1]
        if cax is None:
            return None
        im = cax._gci()
        if im is not None:
            return im

        # If there is no image in the current Axes, search for
        # one in a previously created Axes.  Whether this makes
        # sense is debatable, but it is the documented behavior.
        for ax in reversed(self.axes):
            im = ax._gci()
            if im is not None:
                return im
        return None 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:figure.py

示例5: new_gridlines

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def new_gridlines(self, ax):
        """
        Create and return a new GridlineCollection instance.

        *which* : "major" or "minor"
        *axis* : "both", "x" or "y"

        """
        gridlines = GridlinesCollection(None, transform=ax.transData,
                                        colors=rcParams['grid.color'],
                                        linestyles=rcParams['grid.linestyle'],
                                        linewidths=rcParams['grid.linewidth'])
        ax._set_artist_props(gridlines)
        gridlines.set_grid_helper(self)

        ax.axes._set_artist_props(gridlines)
        # gridlines.set_clip_path(self.axes.patch)
        # set_clip_path need to be deferred after Axes.cla is completed.
        # It is done inside the cla.

        return gridlines 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:axislines.py

示例6: _findoffset

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _findoffset(self, width, height, xdescent, ydescent, renderer):
        "Helper function to locate the legend."

        if self._loc == 0:  # "best".
            x, y = self._find_best_position(width, height, renderer)
        elif self._loc in Legend.codes.values():  # Fixed location.
            bbox = Bbox.from_bounds(0, 0, width, height)
            x, y = self._get_anchored_bbox(self._loc, bbox,
                                           self.get_bbox_to_anchor(),
                                           renderer)
        else:  # Axes or figure coordinates.
            fx, fy = self._loc
            bbox = self.get_bbox_to_anchor()
            x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy

        return x + xdescent, y + ydescent 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:legend.py

示例7: scatter_single

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def scatter_single(ax: Axes, Y: np.ndarray, *args, **kwargs):
    """Plot scatter plot of data.

    Parameters
    ----------
    ax
        Axis to plot on.
    Y
        Data array, data to be plotted needs to be in the first two columns.
    """
    if 's' not in kwargs:
        kwargs['s'] = 2 if Y.shape[0] > 500 else 10
    if 'edgecolors' not in kwargs:
        kwargs['edgecolors'] = 'face'
    ax.scatter(Y[:, 0], Y[:, 1], **kwargs, rasterized=settings._vector_friendly)
    ax.set_xticks([])
    ax.set_yticks([]) 
开发者ID:theislab,项目名称:scanpy,代码行数:19,代码来源:_utils.py

示例8: _plot_colorbar

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _plot_colorbar(self, color_legend_ax: Axes, normalize):
        """
        Plots a horizontal colorbar given the ax an normalize values

        Parameters
        ----------
        color_legend_ax
        normalize

        Returns
        -------
        None, updates color_legend_ax

        """
        cmap = pl.get_cmap(self.cmap)
        import matplotlib.colorbar

        matplotlib.colorbar.ColorbarBase(
            color_legend_ax, orientation='horizontal', cmap=cmap, norm=normalize
        )

        color_legend_ax.set_title(self.color_legend_title, fontsize='small')

        color_legend_ax.xaxis.set_tick_params(labelsize='small') 
开发者ID:theislab,项目名称:scanpy,代码行数:26,代码来源:_baseplot_class.py

示例9: umap

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def umap(adata, **kwargs) -> Union[Axes, List[Axes], None]:
    """\
    Scatter plot in UMAP basis.

    Parameters
    ----------
    {adata_color_etc}
    {edges_arrows}
    {scatter_bulk}
    {show_save_ax}

    Returns
    -------
    If `show==False` a :class:`~matplotlib.axes.Axes` or a list of it.
    """
    return embedding(adata, 'umap', **kwargs) 
开发者ID:theislab,项目名称:scanpy,代码行数:18,代码来源:scatterplots.py

示例10: tsne

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def tsne(adata, **kwargs) -> Union[Axes, List[Axes], None]:
    """\
    Scatter plot in tSNE basis.

    Parameters
    ----------
    {adata_color_etc}
    {edges_arrows}
    {scatter_bulk}
    {show_save_ax}

    Returns
    -------
    If `show==False` a :class:`~matplotlib.axes.Axes` or a list of it.
    """
    return embedding(adata, 'tsne', **kwargs) 
开发者ID:theislab,项目名称:scanpy,代码行数:18,代码来源:scatterplots.py

示例11: trimap

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def trimap(adata, **kwargs) -> Union[Axes, List[Axes], None]:
    """\
    Scatter plot in TriMap basis.

    Parameters
    ----------
    {adata_color_etc}
    {edges_arrows}
    {scatter_bulk}
    {show_save_ax}

    Returns
    -------
    If `show==False` a :class:`~matplotlib.axes.Axes` or a list of it.
    """
    return embedding(adata, 'trimap', **kwargs) 
开发者ID:theislab,项目名称:scanpy,代码行数:18,代码来源:pl.py

示例12: get

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def get(self, key):
        """
        Return the Axes instance that was added with *key*.
        If it is not present, return *None*.
        """
        item = dict(self._elements).get(key)
        if item is None:
            return None
        cbook.warn_deprecated(
            "2.1",
            "Adding an axes using the same arguments as a previous axes "
            "currently reuses the earlier instance.  In a future version, "
            "a new instance will always be created and returned.  Meanwhile, "
            "this warning can be suppressed, and the future behavior ensured, "
            "by passing a unique label to each axes instance.")
        return item[1] 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:figure.py

示例13: test_plot

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def test_plot(foo_extractor):
    rs = FeatureSet(
        features_names=["foo"],
        values={"foo": 1},
        timeserie=TIME_SERIE,
        extractors={"foo": foo_extractor},
    )

    assert isinstance(rs.plot("foo"), axes.Axes)


# =============================================================================
# SPACE
# ============================================================================= 
开发者ID:quatrope,项目名称:feets,代码行数:16,代码来源:test_core.py

示例14: test_Grid2D_plot

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def test_Grid2D_plot():
    grid = Grid2D((-20, 20), (-40, 40), step=0.5)
    ax = grid.plot()
    npt.assert_equal(isinstance(ax, Axes), True) 
开发者ID:pulse2percept,项目名称:pulse2percept,代码行数:6,代码来源:test_geometry.py

示例15: _check_axes_shape

# 需要导入模块: from matplotlib import axes [as 别名]
# 或者: from matplotlib.axes import Axes [as 别名]
def _check_axes_shape(self, axes, axes_num=None, layout=None,
                          figsize=None):
        """
        Check expected number of axes is drawn in expected layout

        Parameters
        ----------
        axes : matplotlib Axes object, or its list-like
        axes_num : number
            expected number of axes. Unnecessary axes should be set to
            invisible.
        layout :  tuple
            expected layout, (expected number of rows , columns)
        figsize : tuple
            expected figsize. default is matplotlib default
        """
        if figsize is None:
            figsize = self.default_figsize
        visible_axes = self._flatten_visible(axes)

        if axes_num is not None:
            assert len(visible_axes) == axes_num
            for ax in visible_axes:
                # check something drawn on visible axes
                assert len(ax.get_children()) > 0

        if layout is not None:
            result = self._get_axes_layout(_flatten(axes))
            assert result == layout

        tm.assert_numpy_array_equal(
            visible_axes[0].figure.get_size_inches(),
            np.array(figsize, dtype=np.float64)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:35,代码来源:common.py


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