I have the following R MWE making use of igraph (manual).
###################
##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()
###################
I use the option "simplify" to prevent loops from appearing, but such function doesn't seem to work... I get the following error:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘simplify’ for signature ‘"igraph"’
In the MWE I show the line with the "simplify" option commented, notice how removing "simplify" the command works, but the loops that I want to avoid appear...
On another note, I don't want the output in .png format, but in .eps. I use the line:
postscript("test.eps", width = 6.83, height = 6, horizontal = FALSE, onefile = FALSE, paper = "special", colormodel = "cmyk", family = "Arial")
as specified in here and here. I use that line with no problem whatsoever when making all kinds of plots, but when using it with network like the one here, I get the error:
Error in text.default(x, y, labels = labels, col = label.color, family = label.family, :
family 'serif' not included in postscript() device
Please help!
Thanks to @bergant, I am posting here the answer.
-Use igraph::simplify in case there is another package masking the function.
-Add the option vertex.label.family="Arial" to override the serif default.
###################
##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()
###################