Add Subscripts to labels in Seurat DimPlot
0
0
Entering edit mode
6 months ago
Saran ▴ 50

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 • 388 views
ADD COMMENT
1
Entering edit mode

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)))
ADD REPLY

Login before adding your answer.

Traffic: 1892 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6