This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Add Subscripts to labels in Seurat DimPlot

Hello,

I am using DimPlot() from the Seurat package to make some final figures. I would like to label the clusters as found below in the UMAP legend.

The only way I am able to remotely get close to doing this is by using scale_color_hue() and changing the legend labels as shown below but for some reason they are right aligned:

dp <- DimPlot(CD4T, label = F, pt.size = 0.6)
dp + scale_color_hue(labels = c(expression("T"[N]*"T"[CM]), expression("T"[EM]), expression("T"[EFF]*"/T"[EMRA]*".17"), 
                                expression("T"[EFF]*"/T"[EMRA]*".1"), expression("T"[EFF]*"/T"[EMRA]*"(mixed)"), 
                                expression("T"[RM]), expression("T"[FH]), expression("T"[reg]), expression("T"[FR]))) +
  theme(axis.text.y=element_text(size=12,color='black', face = "bold"),
        axis.text.x=element_text(size=12,color='black', face = "bold"),
        legend.text=element_text(size=16,color='black', face = "bold"),
        axis.title.y= element_text(size=16,color='black',face = "bold"),
        axis.title.x= element_text(size=16,color='black',face = "bold"))

enter image description here

Is there any way to left align these labels in the legend?

Also, Is there anyway to add subscripts to the cluster labels in the Seurat MetaData?

Thanks,
Sara

dimplot ggplot2 seurat rstudio

Can you try adding this line to your code and playing with it? guides(colour = guide_legend( label.position = "right",override.aes = list(size=3)))

dp + scale_color_hue(labels = c(expression("T"[N]*"T"[CM]), expression("T"[EM]), expression("T"[EFF]*"/T"[EMRA]*".17"), 
                                expression("T"[EFF]*"/T"[EMRA]*".1"), expression("T"[EFF]*"/T"[EMRA]*"(mixed)"), 
                                expression("T"[RM]), expression("T"[FH]), expression("T"[reg]), expression("T"[FR]))) +
  theme(axis.text.y=element_text(size=12,color='black', face = "bold"),
        axis.text.x=element_text(size=12,color='black', face = "bold"),
        legend.text=element_text(size=16,color='black', face = "bold"),
        axis.title.y= element_text(size=16,color='black',face = "bold"),
        axis.title.x= element_text(size=16,color='black',face = "bold"))+
guides(colour = guide_legend( label.position = "right",override.aes = list(size=3)))

0 answers

No answers yet.

Log in to answer this question.