bcm-uga / pcadapt

Performing highly efficient genome scans for local adaptation with R package pcadapt v4
https://bcm-uga.github.io/pcadapt
39 stars 10 forks source link

Modify figures #61

Closed kuratanp closed 3 years ago

kuratanp commented 3 years ago

Hello, I am trying to figure out how to modify the default PCA plot that the PCAdapt package generates. For example, I want the background color to be white instead of gray, change the title, and add the % of variance explained on the x and y-axes (e.g., PC1 21%). Any pointers would be appreciated.

privefl commented 3 years ago

These are ggplot2 plots, so you can easily modify them afterwards. As package ggplot2 is very popular, you find lots of answers just Googling and on Stack Overflow. E.g. try Googling "change background color ggplot2". For the labels, you can use + labs(x = , y = , title = ). You can learn more about ggplot2 at https://privefl.github.io/R-presentation/ggplot2.html.

kuratanp commented 3 years ago

Thank you for the quick reply. What I am confused more about is how to format my object produced from x <-pcadapt(...) into a data.frame to generate ggplots. Would you provide me with an example using tidyr?

privefl commented 3 years ago

You can find some examples at https://github.com/bcm-uga/pcadapt/blob/master/R/plotUtils.R.