<p>You can choose which PC dims to plot by specifying the <code>dims</code> argument within the functions. To use PC-4 and PC-5,</p>

<pre><code>DimPlot(object = pbmc_small, dims = c(4, 5), reduction = "pca")
</code></pre>

<p>and</p>

<pre><code>FeaturePlot(object = pbmc_small, features = "Xist", dims = c(4, 5), reduction = "pca")
</code></pre>

<hr>

<p>Seurat documentation is available <a href="https://cran.r-project.org/web/packages/Seurat/Seurat.pdf" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 4.0
2019-12-19T01:42:45.943Z
Hi Kohl, thank you for your advice. But after I tried that code, I got the error:"Error in Embeddings(object = object[[reduction]])[cells, dims] :
  subscript out of bounds
Calls: DimPlot
Execution halted"    Do you have any idea about this?
hua
CC BY-SA 4.0
2019-12-19T21:57:02.910Z
From the docs: `**reduction** Which dimensionality reduction to use. If not specified, first searches for umap, then tsne, then pca`. I imagine you haven't run UMAP or tSNE yet. Try providing the `reduction` arg, I've updated my answer.
Kohl Kinning
CC BY-SA 4.0
2019-12-20T01:00:59.830Z
Hi Kohl, thank you for your advice. And I have successfully got the PC change, but I would like to know whether we can change the UMPA use? like the PC use?
hua
CC BY-SA 4.0
2019-12-20T19:03:54.907Z
If I understand your question correctly, replace `reduction = "pca"` with `reduction = "umap"`. You'll also have to keep more dims when you do `RunUMAP()`, the default is to keep two. Be sure to add `dims.keep = 5L` to `RunUMAP()` if you want to access dims 4 and 5. If you need any more detail, you should ask another question as this has branch from your original question and would be more helpful for future seekers if it were on it's own.
Kohl Kinning
CC BY-SA 4.0
2019-12-18T22:26:53.203Z
2019-12-19T21:55:40.407Z
2019-12-19T21:55:40.407Z
Kohl Kinning
<p>I would like to know how to change the PC use in the dimplot and featureplot by using Seurat. for we can get the x-axis and the y-axis like PC-1 and PC-2, if I want to use PC-4 and PC-5. How to modify the code?</p>

<seurat><single-cell>
how to change the PC use in the dimplot and feature plot
# how to change the PC use in the dimplot and feature plot

(Asked by: username_0 on 2019-12-18)

I would like to know how to change the PC use in the dimplot and featureplot by using Seurat. for we can get the x-axis and the y-axis like PC-1 and PC-2, if I want to use PC-4 and PC-5. How to modify the code?

**Tags:** seurat, single-cell

---

## 1 answers

### Answer by username_1 on 2019-12-18. Score: 1

You can choose which PC dims to plot by specifying the dims argument within the functions. To use PC-4 and PC-5,
DimPlot(object = pbmc_small, dims = c(4, 5), reduction = "pca")

and
FeaturePlot(object = pbmc_small, features = "Xist", dims = c(4, 5), reduction = "pca")


Seurat documentation is available here.

> **Comments:**
> **username_0**: Hi Kohl, thank you for your advice. But after I tried that code, I got the error:"Error in Embeddings(object = object[[reduction]])[cells, dims] :   subscript out of bounds Calls: DimPlot Execution halted"    Do you have any idea about this?  
> **username_1**: From the docs: `**reduction** Which dimensionality reduction to use. If not specified, first searches for umap, then tsne, then pca`. I imagine you haven't run UMAP or tSNE yet. Try providing the `reduction` arg, I've updated my answer.  
> **username_0**: Hi Kohl, thank you for your advice. And I have successfully got the PC change, but I would like to know whether we can change the UMPA use? like the PC use?  
> **username_1**: If I understand your question correctly, replace `reduction = "pca"` with `reduction = "umap"`. You'll also have to keep more dims when you do `RunUMAP()`, the default is to keep two. Be sure to add `dims.keep = 5L` to `RunUMAP()` if you want to access dims 4 and 5. If you need any more detail, you should ask another question as this has branch from your original question and would be more helpful for future seekers if it were on it's own.  

---

