Is there an easy to modify the subplot titles in DimPlot (Seurat)?
2
0
Entering edit mode
15 months ago
alwayshope ▴ 40

Dear experts,

When using DimPlot to plot the UMAP for the combined Seurat object, say it includes two groups, the combined object after the Dimplot will become one patchwork gg ggplot structure, while how to change each group (treat/control) to treat day1 , control day1? patchwork or ggplot function title or subtitle setting only affects the whole UMAP, not the subplots?

DimPlot(combined, reduction = "umap", split.by = "orig.ident", label = T)

orig.ident are treat & control, but its better to change label to more specific names, which can include the blank

Thanks a lot!

enter image description here

scRNA-seq patchwork DimPlot Seurat • 2.0k views
ADD COMMENT
0
Entering edit mode

It is so amazing!

Thank you very much for all your kind help!

ADD REPLY
1
Entering edit mode
15 months ago
fracarb8 ★ 1.7k

There are multiple ways to do that.

You can edit the ggplot object

gg_figure <- DimPlot(combined, reduction = "umap", split.by = "orig.ident", label = T)
gg_figure$data$orig.ident <- gsub("treat","treat_day1",gg_figure$data$orig.ident)
gg_figure$data$orig.ident <- gsub("control","control_day1",gg_figure$data$orig.ident)

You can change the name of the groups in the object before plotting

combined@meta.data$group <- gsub("treat",...)
# or
combined@meta.data$modified_group <- combined@meta.data$group
combined@meta.data$modified_group <- gsub("treat",...)

Plot each group individually and put them together

# split combined into 2 objects and then 
p1 <- DimPlot(treat, ...) + ggtitle("trat day1)
p2 <- DimPlot(control, ...) + ggtitle("control day1)
p1 | p2
ADD COMMENT
1
Entering edit mode
15 months ago

A simple trick would be to add an additional column in the metadata slot of the Seurat object. Something like this:

combined@meta.data$group <- ifelse(combined@meta.data$orig.ident == "treat","treat day1","control day1")

and then rerun a Dimplot

DimPlot(combined, reduction = "umap", split.by = "group", label = T)
ADD COMMENT

Login before adding your answer.

Traffic: 2109 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