destiny icon indicating copy to clipboard operation
destiny copied to clipboard

color code doesn't work for 3d diffusion map

Open liuweihanty opened this issue 3 years ago • 1 comments

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 <- [email protected][,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)

liuweihanty avatar Sep 10 '20 21:09 liuweihanty