setwd('D:\\09_纳米水稻\\AA修图\\')
library(ggplot2)
library(ggsignif)
library(ggpubr)
data<-read.table('1_plot_dot_corBCD_CK.txt',header = 1)
data$Rep1=log2(data$rep1)
data$Rep2=log2(data$rep2)
table(data$sample)
options(scipen=3)
# data$sample<- factor(data$sample,
# levels= c('<=-1','-1~0',"0~1",">1"),ordered = TRUE)
# data$sample<- factor(data$sample,
# levels= c('Overlap','1~200bp',"201~2000bp",">2000bp"),ordered = TRUE)
> head(data)
rep1 rep2 sample Rep1 Rep2
1 1928 1323 BCD 10.91289 10.369597
2 5745 4417 BCD 12.48809 12.108851
3 5914 4276 BCD 12.52992 12.062046
4 8000 4556 BCD 12.96578 12.153552
5 6327 3264 BCD 12.62731 11.672425
6 49 42 BCD 5.61471 5.392317
ggplot(data, aes(x=Rep1, y=Rep2)) +
geom_point(size=1,alpha=0.8,color='#00CCFF')+
stat_cor(method = 'pearson', aes(x=Rep1, y=Rep2), size = 5,
label.y.npc = "top",color='black')+
geom_smooth( aes(x=Rep1, y=Rep2),method="lm",se=FALSE,colour="red")+
facet_wrap(~sample,nrow=1,scales = 'free')+
theme_classic()+
# xlim(0,200000)+
# scale_fill_brewer(type="seq",palette="Set2")+
ylab('Rep2')+xlab("Rep1")+
# labs(title ='Correlation between gene FC and M value')+
theme(strip.text.x = element_text( colour = 'black',size = 13),#size=8,angle=75
strip.text.y = element_text( colour = 'black',size = 13),
strip.background = element_rect(colour="white", fill="grey"),
axis.title = element_text(#face = "bold",
size = "18",color = "black"),
axis.text.x = element_text(face = "bold",color = "black",#angle = 45,
size = 12, hjust = 0.5, vjust = 0.5),
# axis.text.x = element_text(face = "bold",color = "black",angle = 45,
# size = 12, hjust = 1, vjust = 1),
axis.text.y = element_text(face = "bold",size = 12,color = "black"),
legend.text = element_text(size = 12,face = "bold"),
legend.title = element_text(size = 12,
face = "bold"),
legend.position ='',
# legend.key.size =
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
axis.line = element_line(size=1, colour = "black"), ##################### 坐标轴边框加粗(只能加粗左下轴)
axis.ticks = element_line(size = 1),
# panel.border = element_rect(colour = "black", fill=NA, size=1),
# axis.line = element_line(size=2, colour = "black"),
plot.title = element_text(lineheight=.8, face="bold", hjust=0.5, size =16))
结果如下