介绍:利用ggplot2做dotplot选择信号展示
脚本为: plot_singles_Zscore.r
library(ggplot2)
library(patchwork)
mytheme2 <- theme_bw() + theme(legend.title=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_text(size=8,angle=90),
#axis.title.y = element_text(size=8,angle=90),
axis.text.x=element_text(size=9,angle=0),
axis.text.y = element_text(size=7), ##- biao qian
#axis.ticks.y = element_blank(), ##- ke du xian
#legend.position="none",
legend.key.size = unit(0.4,'cm'),
legend.text = element_text(size=6,angle=0),
strip.text = element_text(size=8)
)
argv<-commandArgs(TRUE)
TEsingle <- read.table(argv[1], header = T, sep="\t")
TEsingle$Chr <- factor(TEsingle$Chr, levels=c("A01", "A02", "A03", "A04", "A05", "A06", "A07", "A08", "A09", "A10"))
p1 <- ggplot(TEsingle, aes(x=Pos/1000000, y=zPvalue, size=zPvalue, colour=zPvalue, fill=Chr)) +
geom_point(alpha=1) + scale_color_gradient(low = "white", high = "red") + scale_size_continuous(range = c(1,2)) +
#geom_point(data=bed, aes(x=Pos/1000000, y=5, colour=Chr, fill=Chr), size=3, shape=11, alpha=0.9) +
facet_grid(. ~ Chr,as.table=TRUE, scales="free_x", space="free_x") +
geom_hline(aes(yintercept=2.33), colour="#990000", linetype="dashed") +
ylab("Zscore(-log10(P-value)") + mytheme2
ggsave(filename="signals_Zscore.pdf",plot=p1,height=4,width=12)
文件格式:
Chr Pos zPvalue
A01 3180 0
A01 3910 0
A01 3999 0
A01 4676 0.330693310446375
A01 6794 0
A01 8039 0.361264532608324
A01 8986 0.293187499389488
A01 9036 0.297853622105339
A01 9490 0.455178261076811
结果图: