I would like to know how to change the UMAP used in Dimplot and FeaturePlot from Seurat: how we can get the x-axis and the y-axis like UMAP-1 and UMAP-2 if I want to use UMAP-4 and UMAP-5. How to modify the code? It is easy to change the PC by using DimPlot(object = pbmc_small, dims = c(4, 5), reduction = "PCA") but if I changed to reduction = "UMAP", I got the error

"Error in Embeddings(object = object[[reduction]])[cells, dims] : subscript out of bounds Calls: DimPlot Execution halted". 

Does anyone have any idea how to solve this problem?

  • 1
    $\begingroup$ that is because UMAP-4 and UMAP-5 are not present in your object...head(object[['umap']]@cell.embeddings), or str(object[['umap']]@cell.embeddings) $\endgroup$
    – Mack123456
    Dec 23, 2019 at 23:37
  • $\begingroup$ Yes, the UMAP-4 and UMAP-5 are not present in my project. So what should I do now? $\endgroup$
    – hua
    Dec 24, 2019 at 2:41
  • $\begingroup$ What is the rationale for using UMAP-4 and UMAP-5? UMAP is different from PCA because you specify a dimension (usually) and it tries to put all information in those two dimensions. $\endgroup$
    – Phoenix Mu
    May 14, 2020 at 13:42

2 Answers 2


Try this:

pbmc_small <- RunUMAP(pbmc_small, dims = 1:10, reduction = "pca", n.components = 5)

#> [1] "UMAP_1" "UMAP_2" "UMAP_3" "UMAP_4" "UMAP_5"

# plot
DimPlot(pbmc_small, reduction = "umap", dims = c(4, 5))

enter image description here

This should work with Seurat version 3.1.5

#> [1] '3.1.5'

Change n.components / max.dims (depending on your seurat version) to 5 when you call runUMAP and you should have dim 4 and 5 available.

  • $\begingroup$ Hi Pallie, i have tried to use "SAN <- RunUMAP(SAN, dims = 1:10, max.dim = 5L, dims.keep = 5L)" and there still are no UMAP-4 and UMAP-5. $\endgroup$
    – hua
    Dec 24, 2019 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.