igraph - 透明边缘问题

时间:2016-08-07 23:04:53

标签: r igraph

以下代码创建并绘制了包含4个节点和标准法线边缘的图形:

library(igraph)
set.seed(1)
adjmat <- matrix(rnorm(16), 4, 4); adjmat <- 1/2 * (adjmat + t(adjmat)); diag(adjmat) <- 0
ig <- graph_from_adjacency_matrix(adjmat, "undirected", 
                                      weighted = TRUE, diag = FALSE)
edge_col <- function(x, alpha) 
             ifelse(x > 0, rgb(0,0,1,alpha = alpha), rgb(1,0,0,alpha = alpha))

# this works fine
plot(ig, edge.color = edge_col(E(ig)$weight, alpha = 1))

# no edges show up in plot
plot(ig, edge.color = edge_col(E(ig)$weight, alpha = 0.9))

使用alpha中的不透明度参数rgb设置颜色透明度。为什么alpha < 1时没有边缘显示?

感谢。

0 个答案:

没有答案