我使用包'VennDiagram'绘制四个维恩图,称为P1,P2,P3,P4。然后想要grid.arrange将四个图形放在一个页面上。
我使用的代码是:
P1=draw.pairwise.venn(20,63,6,category = c("blastp", "HMM"), lty =rep("blank",2),fill = c("#9067A7", "#9067A7"), alpha = rep(0.5, 2), cat.pos = c(0,0),cat.dist = rep(0.025, 2),inverted=TRUE)
P2=draw.pairwise.venn(3,242,3,category = c("blastp", "HMM"), lty = rep("blank",2),fill = c("#AB6857", "#AB6857"), alpha = rep(0.5, 2), cat.pos = c(0,0),cat.dist = rep(0.025, 2))
P3=draw.pairwise.venn(7,107,0,category = c("blastp", "HMM"), lty = rep("blank",2),fill = c("#bc767c", "#bc767c"), alpha = rep(0.5, 2), cat.pos = c(0,0),cat.dist = rep(0.025, 2))
P4=draw.pairwise.venn(11,1,0,category = c("blastp", "HMM"), lty = rep("blank",2),fill = c("#628130", "#628130"), alpha = rep(0.5, 2), cat.pos = c(0,0),cat.dist = rep(0.025, 2))
grid.arrange(P1, P2, P3, P4, ncol=2)
但是出现了错误:
Error: $ operator is invalid for atomic vectors
尝试时:
grid.arrange(grid.draw(P1), grid.draw(P2), grid.draw(P3), grid.draw(P4), ncol=2)
仍有错误,但改为:
only 'grobs' allowed in "gList"
我想在一页上粘贴这四个。
答案 0 :(得分:3)
我不确定这与更新有关,但我总是安排像以下那样的文件:
grid.arrange(grobTree(P1), grobTree(P2), grobTree(P3), grobTree(P4), ncol=2)
您需要将venndiagrams转换为网格图形对象(grob)。