seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Colors in SpatialDimPlot() for multiple slides

Open JJBio opened this issue 2 years ago • 1 comments

Dear Seurat Team,

# cols - vector with colors SpatialDimPlot(spatialData, cols= cols)

The cols parameter changes the colors. However, if I have multiple slide and not all clusters are represented on each slide, the color order changes and the colors between the slides do not fit together anymore. If I do not specify my own colors this is not the case, but with the default colors the different clusters are difficult to see.

Is there a way to fix this? Thank you so much!

JJBio avatar Jun 20 '22 13:06 JJBio

Have you tried naming the colors based off their cluster label?

Example:

colors <- c(cluster1 = "red", cluster2 = "green")

mojaveazure avatar Jul 01 '22 19:07 mojaveazure

Hi, I am closing this issue for now as we have not got any response. Will reopen it if there is any update.

longmanz avatar Jul 07 '23 21:07 longmanz

I had the same problem and the solution from mojaveazure is working. However, I have to use c("1"="red" ,"2"="green")

nina-hahn avatar Mar 13 '24 10:03 nina-hahn