# how to change the PC use in the dimplot and feature plot

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?

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.

• 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 Dec 19 '19 at 1:42
• 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 Dec 19 '19 at 21:57
• 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 Dec 20 '19 at 1:00
• 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 Dec 20 '19 at 19:03