plotweb(双向)上的互动“强度”

时间:2019-05-15 11:01:51

标签: r bipartite

我试图突出显示plotweb()中的主要交互。

在这里查看:How do I change color of interactions based on interaction value using an ifelse() statement in an plotweb bipartite?,它几​​乎可以正常工作,但是由于某种原因,主要交互(行号为22的Apidae)未被很好地识别。如果我使用col.interaction上使用的函数创建一个数据框(即“ col.interaction = t(ifelse(data [,] <10,Adjustcolor('grey80',alpha.f = 0.5)),Adjustcolor('darkturquoise' ,alpha.f = 0.5)))“),它显示的颜色已根据我的要求进行了相应更改,但绘图不正确。我不知道怎么了...

data=structure(list(Apidae = c(1, 1, 0, 27, 1, 10, 0, 2, 0, 0, 0, 
1, 4, 0, 0, 0, 0, 2, 0, 0, 0, 40, 0, 3, 0, 0, 0, 1, 0, 0, 3, 
0, 3, 1, 8, 0, 0, 8, 3, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 2, 0, 
21, 2, 12, 0, 0, 1, 6), Bombylidae = c(0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0), Chrysomelidae = c(0, 0, 0, 1, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Curculionidae = c(0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 1, 0, 1, 0, 0, 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0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Staphylinidae = c(0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Syrphidae = c(0, 
0, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), Tachinidae = c(0, 
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Vespidae = c(0, 
0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 1, 5, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 4, 1, 0, 0, 0, 0, 0, 
1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0)), class = "data.frame", row.names = c(NA, 
59L)) ## the data frame

plotweb(data, text.rot=90, arrow="down.center", y.lim=c(-1,2.5), bor.col.interaction= NA, col.interaction= t(ifelse(data[,]<10, adjustcolor('grey80', alpha.f = 0.5), adjustcolor('darkturquoise', alpha.f = 0.5)))) ## the plot that for some reason is not changing some colors it should

col.interaction.table= col.interaction= t(ifelse(data[,]<10, adjustcolor('grey80', alpha.f = 0.5), adjustcolor('darkturquoise', alpha.f = 0.5))) ## the data frame showing the functiong apparently is working properly                       

因此,我希望所有高于10的交互都被“突出显示”。 感谢您的帮助。

0 个答案:

没有答案