好吧,有一个技巧,您需要绘制与不同边缘宽度数量一样多的图形,并且每次只绘制给定的边缘子集,并使用“右”箭头大小。使用add=TRUE
参数将它们绘制在彼此之上。也许您还想只绘制一次顶点。
顺便提一句。您可以在https://github.com/igraph/igraph/issues提交功能请求
编辑:这是一个例子:
library(igraph)
## (almost) your example data
d <- data.frame(start=c("a","a","b","c"),
end=c("b","b","c","b"),
size=1:4)
graph <- graph.data.frame(d, directed=TRUE)
## The plotting function
eqarrowPlot <- function(graph, layout, edge.lty=rep(1, ecount(graph)),
edge.arrow.size=rep(1, ecount(graph)),
vertex.shape="circle",
edge.curved=autocurve.edges(graph), ...) {
plot(graph, edge.lty=0, edge.arrow.size=0, layout=layout,
vertex.shape="none")
for (e in seq_len(ecount(graph))) {
graph2 <- delete.edges(graph, E(graph)[(1:ecount(graph))[-e]])
plot(graph2, edge.lty=edge.lty[e], edge.arrow.size=edge.arrow.size[e],
edge.curved=edge.curved[e], layout=layout, vertex.shape="none",
vertex.label=NA, add=TRUE, ...)
}
plot(graph, edge.lty=0, edge.arrow.size=0, layout=layout,
vertex.shape=vertex.shape, add=TRUE, ...)
invisible(NULL)
}
## Test
eqarrowPlot(graph, layout.auto(graph), edge.arrow.size=E(graph)$size/3,
edge.width=E(graph)$size)
不过,非常宽的边缘看起来很糟糕。