Skip to content

why cannot set the specific color? #1963

@xuebaliang

Description

@xuebaliang

...
colors_use = ['red', 'blue', 'green', 'purple', 'yellow', 'brown', 'black', 'peru', 'orange', 'olive',
'darksage', 'cyan', 'lime', 'pink', 'teal', 'violet', 'darkblue', 'magenta', 'coral', 'gray']
adata = sc.AnnData(embedding)
adata.obs["category"] = label.astype(np.int)
adata.obs["domain"] = batch.astype(np.int)
sc.tl.tsne(adata, use_rep = 'X', n_jobs = 10)
adata.uns["category_colors"] = list(colors_use[:len(np.unique(label))])
adata.uns["domain_colors"] = list(colors_use[:len(np.unique(batch))])
sc.pl.tsne(adata, color = ["category", "domain"], title = ["class", "domain"],
show = False, size = 50000 / len(label), save = "/{}.pdf".format(file))

My scanpy version is 1.4.6, but when I run the above codes, I find that the color is continuous, why cannot set my specific color?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions