DESeq2::plotPCA plotting error
1
0
Entering edit mode
960942 • 0
@e6da1b66
Last seen 9 months ago
United Kingdom

Hi all, I have an error when plotting a PCA graph on R studio. My graph seems to come back where the height dimension is very small making a thin rectangular graph compared to a square. I believe it is due to the scaling on the y and x axis being the same yet PC1 represents 96% variance compared to PC2% representing 2%. Is there a way to change the scaling size within DESeq2:plotPCA without using other programs? I have tried exporting or copying the graph but it still has this issue.

Thanks!

sessionInfo( )



RStudio PCA DESeq2 • 661 views
2
Entering edit mode
swbarnes2 ★ 1.2k
@swbarnes2-14086
Last seen 11 hours ago
San Diego

Plot PCA is a pretty bare bones simple little plotter, and you can't change much with it. To get more control, you are going to have to make the plot yourself, then you can control its dimensions, and stretch that Y axis like you want. I can tell you that with ggplot2, you can add coord_fixed(ratio = 1.5)` to fix the proportions. I don't know how to do it with plot or plotly, so you'll have to google that.

1
Entering edit mode

The output is ggplot, so yes, you can just add extra config functions with “+ …”

Re the OP question. The coordinate in the plot are actually correct this way. This is giving a fixed aspect ratio. Other plots would be distorted.

0
Entering edit mode

Hi there, I did think this afterwards, I am not use to seeing PC1 having such high variability on data! ;-P

Thank you!

0
Entering edit mode

Sure, the plot is correct as it is, but if they want it distorted, then it can be done.

(By "fix" I mean "force them to be what you want" not "correct them").