Entering edit mode
2.9 years ago
bk11
★
3.0k
Hi,
I have been trying to add Seurat object name in the DimPlot Title without any success. Could you please help me how it can be done? My code-
x=c(seuratobject1, seuratobject2)
pdf("plots.pdf", onefile = TRUE)
for (i in x){
b02 <- RunPCA(i, assay = "SCT", verbose = FALSE)
b02 <- FindNeighbors(b02, reduction = "pca", dims = 1:30)
b02 <- FindClusters(b02, verbose = FALSE)
b02 <- RunUMAP(b02, reduction = "pca", dims = 1:30)
myTitle <- deparse(substitute(j))[1]
p=print(DimPlot(b02, reduction = "umap", label = TRUE)+ggtitle(myTitle)+ SpatialDimPlot(b02, label = TRUE, label.size = 3))
}
dev.off()
Thank you! Sorry
j
was typo in the code it should have beeni
. Instead ofx[i]
, I usedx[[i]]
and it works perfectly. I was able to print Seurat object name in ggtitle using following code.