核苷酸多态性(Pai) boxplot

2022-12-19  本文已影响0人  pumpkinC

介绍:使用ggplot2绘制Pai的boxplot图

library(ggplot2)

mytheme2 <- theme_bw() + theme(legend.title=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(),axis.title.x=element_blank(), axis.text.x=element_text(size=8,angle=0), legend.position="none",legend.key.size = unit(0.8,'cm'), legend.text = element_text(size=8,angle=0))


data <- read.table("Pai.values.lst", header = TRUE, sep="\t")

data$Pop <- factor(data$Pop, levels=c("Turniprape", "Oilseed", "sarson"))  


p1 <- ggplot(data, aes(x=Pop, y=Pivalue, fill=Pop)) +
      geom_boxplot(notch = FALSE, notchwidth = 0.7, width=.5, outlier.colour = "#f58f98", outlier.shape = 1, outlier.stroke=0.3, outlier.alpha=0.4) +
      stat_summary(fun.y = "mean", geom = "point",  color = "white", fill= "white", shape = 1, size = 1) +
      mytheme2 + xlab("Morphotypes") + ylab("Nucleotide diversity")

ggsave(file="pai.boxplot.png", plot=p1, width = 2.5, height = 3)
ggsave(file="pai.boxplot.pdf", plot=p1, width = 2.5, height = 3)

文件格式(Pai.values.lst):

Chr Pos Zpi Pivalue Pop
A01 100000  0.569469586153368   0.3228234201884714  Turniprape
A01 100000  -1.24581247819341   0.1518795204597245  sarson
A01 100000  0.848324891508388   0.3490830380702748  Oilseed
A01 105000  0.588066715494564   0.3245746994391083  Turniprape
A01 105000  0.877307639046494   0.3518123240508535  Oilseed
A01 105000  -1.21688321787549   0.1546037695844976  sarson

结果图展示:

pai.boxplot.png
上一篇 下一篇

猜你喜欢

热点阅读