admin管理员组

文章数量:1568355

structure图一页多图

library(ggplot2)
library(grid)
library(cowplot)
## 我这里是9个文件,要画9张图,画到一页上,且是9行1列的这种
ta1 = read.table("fout.2.meanQ")
ta2 = read.table("fout.3.meanQ")
ta3 = read.table("fout.4.meanQ")
ta4 = read.table("fout.5.meanQ")
ta5 = read.table("fout.6.meanQ")
ta6 = read.table("fout.7.meanQ")
ta7 = read.table("fout.8.meanQ")
ta8 = read.table("fout.9.meanQ")
ta9 = read.table("fout.10.meanQ")
tiff(filename = "faststructure_flint.tif", width = 100, height = 50, units = "cm", compression = "lzw",res = 600)
par(mfrow=c(9,1))
par(mar=c(2,4,5,4))
barplot(t(as.matrix(ta1)),col = rainbow(2),
        # xlab = "Individual",
        # ylab = "Ancestry",
        # main = "alldata",
        # cex.names = 5,
        border = NA)
mtext("flint",side = 3,line= 0,cex = 5)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta2)),col = rainbow(3),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta3)),col = rainbow(4),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta4)),col = rainbow(5),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta5)),col = rainbow(6),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta6)),col = rainbow(7),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(2,4,2,4))
barplot(t(as.matrix(ta7)),col = rainbow(8),
        # xlab = "Individual",
        # ylab = "Ancestry",
        border = NA)
par(mar=c(5,4,2,4))
barplot(t(as.matrix(ta8)),col = rainbow(9),
        # xlab = "Individual",
        # cex.axis = 5,
        # ylab = "Ancestry",
        border = NA)
mtext("Individual",side = 1,line = 4,cex = 5)
dev.off()


结果如下:

本文标签: 画图多图图一语言Structure