我有一个非常大的igraph但是当我绘制时,我希望只显示特定的标签。这些标签保存在不同的dfs(activator
和receptor
)中。
我尝试过:
nodes <- data.frame(symbol = LETTERS[1:7])
edges <- data.frame(from=c("B", "C", "D", "D", "D", "E", "A", "G"),
to = c("A", "B", "A", "E", "B", "A", "F", "F"))
activator <- c('A')
receptor <- c('E', 'F', 'G')
g <- graph_from_data_frame(edges, directed=TRUE, vertices=nodes)
print(g, e=TRUE, v=TRUE)
plot(g, vertex.label1 = ifelse(V(g)$name %in% c(activator, receptor), V(g)$name, NA))
但它不起作用。有什么意见吗?