gpt4 book ai didi

r - 更新后,gridExtras 中的 grid.arrange 以 “only ' grobs' allowed in 'gList' 退出

转载 作者:行者123 更新时间:2023-12-02 03:56:43 30 4
gpt4 key购买 nike

我使用'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"  

我想将这四个粘贴到一页上。

最佳答案

我不确定这是否与更新有关,但我总是排列文图,例如:

grid.arrange(grobTree(P1), grobTree(P2), grobTree(P3), grobTree(P4), ncol=2)

您需要将文图转换为网格图形对象 (grob)。

关于r - 更新后,gridExtras 中的 grid.arrange 以 “only ' grobs' allowed in 'gList' 退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43653983/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com