How to 'organize' multiple umap/genes generates with Seurat `FeaturePlot`in a specific way
2
0
Entering edit mode
13 months ago
camillab. ▴ 160

Hi,

Do you know how to 'organize' multiple umap generates with Seurat FeaturePlotin a specific way? For example organize 4 plots all all vertically or horizontally instead of having them organised as 2x2 or only plot_grid is the solution?

This is my code:

SelectedGenes2 = c("Calb2","Rxrg", "B3gat1", "Ephx4")
plot <- FeaturePlot(pbmc, features = SelectedGenes2, label = T) 
plot + plot_annotation(title = "Cell type1",  theme = theme(plot.title = element_text(size = 18, face = 'bold', hjust = 0.5)))
ggsave("Umap Cell type1.tiff")

Thank you
Camilla

R FeaturePlot Umap Seurat • 1.4k views
ADD COMMENT
0
Entering edit mode

camillab. - After a certain version of seurat, i cannot recall, all seurat plot objects became exportable as ggplot objects. As a result, now any plot management system that can work with ggplot objects can be used to arrange plots coming from seurat.

The data visualization vignette from the seurat website itself addresses this. See: https://satijalab.org/seurat/articles/visualization_vignette. Here, you will see patchwork, which others have already recommended, mentioned; but there are other solutions granted the decision to standardize to ggplot...

ADD REPLY
2
Entering edit mode
13 months ago
fracarb8 ★ 1.7k

You can set ncol=1 (or ncol=4).

Otherwise, plot should be of patchwork class

> class(plot)
[1] "patchwork" "gg"        "ggplot"

You can access each individual plots as you would do with elements of a list, and you can then rearrange them like you please

plot[[1]] | plot[[4]] | plot[[2]]  | plot[[3]]
plot[[1]] / plot[[2]] / plot[[3]] / plot[[4]]
ADD COMMENT
0
Entering edit mode
13 months ago
bk11 ★ 3.0k

You can use patchwork. Please check this link.

ADD COMMENT
0
Entering edit mode

thanks but if I want to use patchwork I have to generate different umap for every gene and not use the code I wrote in the post so the strategy is it's basically the same if I wanted to use plot_grid no?

ADD REPLY

Login before adding your answer.

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