This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to 'organize' multiple umap/genes generates with Seurat `FeaturePlot`in a specific way

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

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...

2 answers

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]]

You can use patchwork. Please check this link.

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?

Log in to answer this question.