當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。