R - igraph 问题:为什么选项 "simplify" 不起作用?以及如何生成输出的 EPS?

R - Problems with igraph: Why isn't the option "simplify" working? And how can I generate an EPS of the output?

我有以下使用 igraph (manual) 的 R MWE。

###################
##MWE
iref.sub <- matrix(c("2599030","2068280","9148596","2888723","5001159","2068280","2068280","2068280","2068280","1396470","855318","2068280","2068280","763487","855318","9148596","9148596","907507","907507","907507","2068280","2599030","763487","2068280","855318","4029829","2888723","907507","1375102","1646161","799094","955359","1110650","623716","1557992","1540685","917390","1215731","1025258|1119746","1609966","1625326","990926","X","X","X","X","X","X","X","X","X","X","C|X","X","X","X","1","1","1","1","1","1","1","1","1","1","1","1","1","1"), ncol=5)
mygraph <- convert_edgeList_to_graph(iref.sub, "undirected", "igraph")
#mylayout <- layout.kamada.kawai(simplify(mygraph, edge.attr.comb="min"))
mylayout <- layout.kamada.kawai(mygraph)
#postscript("test.eps", width = 6.83, height = 6, horizontal = FALSE, onefile = FALSE, paper = "special", colormodel = "cmyk", family = "Arial")
png(filename="test.png")
#plot(simplify(mygraph, edge.attr.comb="min"), layout=mylayout)
plot(mygraph, layout=mylayout)
dev.off()
###################

我使用选项 "simplify" 来防止出现循环,但这样的功能似乎不起作用...我收到以下错误:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘simplify’ for signature ‘"igraph"’

在 MWE 中,我显示了注释 "simplify" 选项的行,请注意删除 "simplify" 命令是如何工作的,但是我想避免的循环出现了...

另一方面,我不想要 .png 格式的输出,而是 .eps 格式的输出。我使用这条线:

postscript("test.eps", width = 6.83, height = 6, horizontal = FALSE, onefile = FALSE, paper = "special", colormodel = "cmyk", family = "Arial")

here and here 中所述。在制作各种图时,我使用那条线没有任何问题,但是当像这里那样将它与网络一起使用时,我得到错误:

Error in text.default(x, y, labels = labels, col = label.color, family = label.family,  : 
  family 'serif' not included in postscript() device

请帮忙!

感谢@bergant,我在这里发布答案。

-使用 igraph::simplify 以防有另一个包屏蔽了该功能。

- 添加选项 vertex.label.family="Arial" 以覆盖衬线默认值。

###################
##MWE
iref.sub <- matrix(c("2599030","2068280","9148596","2888723","5001159","2068280","2068280","2068280","2068280","1396470","855318","2068280","2068280","763487","855318","9148596","9148596","907507","907507","907507","2068280","2599030","763487","2068280","855318","4029829","2888723","907507","1375102","1646161","799094","955359","1110650","623716","1557992","1540685","917390","1215731","1025258|1119746","1609966","1625326","990926","X","X","X","X","X","X","X","X","X","X","C|X","X","X","X","1","1","1","1","1","1","1","1","1","1","1","1","1","1"), ncol=5)
mylayout <- layout.kamada.kawai(igraph::simplify(mygraph, edge.attr.comb="min"))
mylayout <- layout.kamada.kawai(mygraph)
postscript("test.eps", width = 6.83, height = 6, horizontal = FALSE, onefile = FALSE, paper = "special", colormodel = "cmyk", family = "Arial")
plot(igraph::simplify(mygraph, edge.attr.comb="min"), layout=mylayout, vertex.label.family="Arial")
dev.off()
###################