Change axis scale for plotting PCA in DESeq2
1
0
Entering edit mode
nfaizo • 0
@nfaizo-22865
Last seen 4.6 years ago

I used plotPCA function from DESeq2 to generate PCA (using the code plotPCA(rld)) for 2 groups of samples (untreated and treated). The sample dots look a bit far away from each other although the 2 groups are still separable. How can I change the axis scales so I bring the samples in each group closer together? Thank you

deseq2 • 3.7k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States

The plotPCA function uses ggplot2 to do the plotting, so all you need to do is capture the output in a variable and make changes yourself.

z <- plotPCA(<args go here>)
z + coord_fixed(<xlim and ylim arguments go here>)

There are approximately three gazillion answers to a Google search for 'ggplot change axis' or whatever, or you could look at ?coord_fixed. I find in general that Googling what I want to do with tidyverse stuff is usually much easier than trying to trudge through the documentation or (gasp) trying to read the code to figure out what's up.

ADD COMMENT
0
Entering edit mode

Now three gazillion + 1!

ADD REPLY
1
Entering edit mode

Doing my part to make the tidyverse even more popular amongst the youngs.

ADD REPLY

Login before adding your answer.

Traffic: 667 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6