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

color code doesn't work for 3d diffusion map #40

Open
liuweihanty opened this issue Sep 10, 2020 · 1 comment
Open

color code doesn't work for 3d diffusion map #40

liuweihanty opened this issue Sep 10, 2020 · 1 comment

Comments

@liuweihanty
Copy link

liuweihanty commented Sep 10, 2020

Hi there! Thanks for the package! I'm using destiny to plot a diffusion map from my seurat object. I use the cell cluster names(HSC, B, Neutrophils..) as my color by argument. I was able to plot for 2d graph for no problem(code as below), however, when I do 3d plot by plot(dm,c(1,2,3),col_by = "celltype",pch = 10), there's an error message saying : Error in plot.xy(xy.coords(x, y), type = type, ...) : invalid color name 'B'. Same error message when I try plot3d(). Do you know what might cause this issue? Thanks!

library(Biobase)
ct <-GetAssayData(object = seu)
ct<-ct[VariableFeatures(seu),]
ct <- as.ExpressionSet(as.data.frame(t(ct)))
ct$celltype <- seu@meta.data[,c("clust.ident")]
dm <- DiffusionMap(ct,k = 10,n_pcs = 50)

library(scales)
palette(hue_pal()(8)) #I have 8 clusters
plot(dm,c(1,2),col_by = "celltype",pch = 10)
@MarcusLCC
Copy link

MarcusLCC commented May 8, 2022

Hi @liuweihanty, I got the same error when trying to plot 3d diffusion map, but the work around that I found is to provide the "factor" to "col" argument, instead of directly specifying the column name.

Such as
plot(dm, col = as.factor(dm$celltype), pch = 10)

Best
Marcus

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

2 participants