ggplot2

Reorder x axis

tmpA$group=factor(tmpA$group,levels=c("WT_d0","WT_d6","M1_d0","M1_d6","M2_d0","M2_d6"))

Add a title

g=g+theme(plot.title=element_text(hjust=0.5,size=10))+ggtitle("title")

Rotate x axis labels

g=g+theme(axis.text.x=element_text(angle=90,vjust=0.5,hjust=1))

Install R package specifying repos

install.packages("RISmed",repos="https://cran.ism.ac.jp/")

PCA plot with proportion explained

tmp2=prcomp(t(tmp1[apply(tmp1,1,sd)>0,]),scale=T)

tmp3=as.data.frame(tmp2$x)

tmp4=as.data.frame(t(summary(tmp2)$importance))[,c("Proportion of Variance","Cumulative Proportion")]

tmp3$group=sub("\\..*$","",rownames(tmp3))

g=ggplot(tmp3,aes(x=PC1,y=PC2,colour=group))+geom_point()+theme_bw()+xlab(paste0("PC1 (",round(tmp4["PC1",1]*100,digits=4),"%)"))+ylab(paste0("PC2 (",round(tmp4["PC2",1]*100,digits=4),"%)"))

ggsave("PCA.pdf",g,width=4,height=3.1)

Change y-axis breaks

g=g+scale_y_continuous(breaks=seq(0,100,by=20),limits=c(0,100))