跳到内容

将顶点放置在圆上,按照它们的顶点 ID 顺序。

用法

layout_in_circle(graph, order = V(graph))

in_circle(...)

参数

graph

输入图。

order

要放置在圆上的顶点,按照它们期望的放置顺序。未包含在此处的顶点将放置在 (0,0)。

...

传递给 layout_in_circle()

一个数值矩阵,包含两列,每个顶点一行。

详细信息

如果您想以不同的顺序排列顶点,请使用 permute() 函数对它们进行排列。

作者

Gabor Csardi csardi.gabor@gmail.com

示例


## Place vertices on a circle, order them according to their
## community
library(igraphdata)
data(karate)
karate_groups <- cluster_optimal(karate)
#> This graph was created by an old(er) igraph version.
#>  Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
coords <- layout_in_circle(karate,
  order =
    order(membership(karate_groups))
)
V(karate)$label <- sub("Actor ", "", V(karate)$name)
V(karate)$label.color <- membership(karate_groups)
V(karate)$shape <- "none"
plot(karate, layout = coords)