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


Python cycler.Cycler方法代码示例

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


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

示例1: adjust_palette

# 需要导入模块: import cycler [as 别名]
# 或者: from cycler import Cycler [as 别名]
def adjust_palette(palette, length):
    islist = False
    if isinstance(palette, list):
        islist = True
    if (islist and len(palette) < length) or (
        not isinstance(palette, list) and len(palette.by_key()["color"]) < length
    ):
        if length <= 28:
            palette = palettes.default_26
        elif length <= len(palettes.default_64):  # 103 colors
            palette = palettes.default_64
        else:
            palette = ["grey" for _ in range(length)]
            logg.info("more than 103 colors would be required, initializing as 'grey'")
        return palette if islist else cycler(color=palette)
    elif islist:
        return palette
    elif not isinstance(palette, Cycler):
        return cycler(color=palette)
    else:
        return palette 
开发者ID:theislab,项目名称:scvelo,代码行数:23,代码来源:utils.py

示例2: default_palette

# 需要导入模块: import cycler [as 别名]
# 或者: from cycler import Cycler [as 别名]
def default_palette(palette: Union[Sequence[str], Cycler, None] = None) -> Cycler:
    if palette is None:
        return rcParams['axes.prop_cycle']
    elif not isinstance(palette, Cycler):
        return cycler(color=palette)
    else:
        return palette 
开发者ID:theislab,项目名称:scanpy,代码行数:9,代码来源:_utils.py

示例3: dpt_groups_pseudotime

# 需要导入模块: import cycler [as 别名]
# 或者: from cycler import Cycler [as 别名]
def dpt_groups_pseudotime(
    adata: AnnData,
    color_map: Union[str, Colormap, None] = None,
    palette: Union[Sequence[str], Cycler, None] = None,
    show: Optional[bool] = None,
    save: Union[bool, str, None] = None,
):
    """Plot groups and pseudotime."""
    _, (ax_grp, ax_ord) = pl.subplots(2, 1)
    timeseries_subplot(
        adata.obs['dpt_groups'].cat.codes,
        time=adata.obs['dpt_order'].values,
        color=np.asarray(adata.obs['dpt_groups']),
        highlights_x=adata.uns['dpt_changepoints'],
        ylabel='dpt groups',
        yticks=(
            np.arange(len(adata.obs['dpt_groups'].cat.categories), dtype=int)
            if len(adata.obs['dpt_groups'].cat.categories) < 5
            else None
        ),
        palette=palette,
        ax=ax_grp,
    )
    timeseries_subplot(
        adata.obs['dpt_pseudotime'].values,
        time=adata.obs['dpt_order'].values,
        color=adata.obs['dpt_pseudotime'].values,
        xlabel='dpt order',
        highlights_x=adata.uns['dpt_changepoints'],
        ylabel='pseudotime',
        yticks=[0, 1],
        color_map=color_map,
        ax=ax_ord,
    )
    savefig_or_show('dpt_groups_pseudotime', save=save, show=show) 
开发者ID:theislab,项目名称:scanpy,代码行数:37,代码来源:__init__.py

示例4: test_validator_valid

# 需要导入模块: import cycler [as 别名]
# 或者: from cycler import Cycler [as 别名]
def test_validator_valid(validator, arg, target):
    res = validator(arg)
    if isinstance(target, np.ndarray):
        assert np.all(res == target)
    elif not isinstance(target, Cycler):
        assert res == target
    else:
        # Cyclers can't simply be asserted equal. They don't implement __eq__
        assert list(res) == list(target) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:11,代码来源:test_rcparams.py

示例5: default_palette

# 需要导入模块: import cycler [as 别名]
# 或者: from cycler import Cycler [as 别名]
def default_palette(palette=None):
    if palette is None:
        return rcParams["axes.prop_cycle"]
    elif not isinstance(palette, Cycler):
        return cycler(color=palette)
    else:
        return palette 
开发者ID:theislab,项目名称:scvelo,代码行数:9,代码来源:utils.py


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