Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DimPlot cannot color correctly #4124

Closed
liuweihanty opened this issue Feb 22, 2021 · 6 comments
Closed

DimPlot cannot color correctly #4124

liuweihanty opened this issue Feb 22, 2021 · 6 comments

Comments

@liuweihanty
Copy link

Hi there, I was trying to use Dimplot to do a simple visualization of my data. The identity I used is a column called "label_coarse" stored in metadata, and is of data type "chr", I used the code below

Idents(seu.integrated) <- "label_coarse"
DimPlot(seu.integrated, group.by = "label_coarse",reduction = "umap"),

and the following error pops up:
Error: Must request at least one colour from a hue palette.

do you know how to resolve this? Thank you very much in advance!

@jaisonj708
Copy link
Collaborator

Please check to make sure all items in label_coarse have a value

@CarlottaHS
Copy link

Hi! I also run into the same error.

I am setting the Idents back to the originally created seurat_cluster column:
Idents(combined) <- "seurat_clusters"
DimPlot(object = combined, reduction = "umap")
Resulting in: ERROR while rich displaying an object: Error: Must request at least one colour from a hue palette.

I checked my meta.data columns or NA or empty entries:
allmisscols <- sapply(combined@meta.data, function(x) all(is.na(x) | x == '' ))
allmisscols
Resulting in:
orig.ident 0 nCount_RNA 0 nFeature_RNA 0 sampleName 0 percent.mt 0 RQ_GEX 0 area 0 disease 0 vaccine 0 RNA_snn_res.0.8 0 seurat_clusters 0 sub.cluster 0 cell_type 0 total_count 0 count_cell_type 0 frequency_cell_type 0 subject 0

So as far as I am aware my meta.data has no missing value.

Do you know how to resolve this?
Thanks already in advance!

@ncalistri
Copy link

ncalistri commented Mar 31, 2022

Check to make sure that your Seurat object's metadata has retained the row names (should be cell barcode by default) as those are required for some Seurat plotting functions.

rownames(seurat_object@meta.data)

I've received a similar error message after manipulating the metadata data.frame, and found that I had accidentally converted it to a tibble and removed the rownames.

@KinSimon96
Copy link

KinSimon96 commented Apr 1, 2022

Hey,

Facing the same problem, but only for violin plots. Did someone find the way to fix it ?

Thanks,
Simon

@CarlottaHS
Copy link

I solved the error in the same way as @ncalistri did.
Now I make sure to keep the row names in the object, when I manipulate the metadata. One has to be especially careful when using functions from the tidyverse suite as that then typically happens.

@AayushiNotra
Copy link

How do I fix missing values from my seurat meta data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants