此布局将顶点放置在矩形网格上,可以是二维或三维。
详细信息
该函数将顶点放置在一个简单的矩形网格上,一个接一个。 如果要更改顶点的顺序,请参阅 permute()
函数。
参见
有关其他布局生成器,请参阅 layout()
其他图形布局:add_layout_()
、component_wise()
、layout_()
、layout_as_bipartite()
、layout_as_star()
、layout_as_tree()
、layout_in_circle()
、layout_nicely()
、layout_on_sphere()
、layout_randomly()
、layout_with_dh()
、layout_with_fr()
、layout_with_gem()
、layout_with_graphopt()
、layout_with_kk()
、layout_with_lgl()
、layout_with_mds()
、layout_with_sugiyama()
、merge_coords()
、norm_coords()
、normalize()
作者
Tamas Nepusz ntamas@gmail.com
示例
g <- make_lattice(c(3, 3))
layout_on_grid(g)
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 1 0
#> [3,] 2 0
#> [4,] 0 1
#> [5,] 1 1
#> [6,] 2 1
#> [7,] 0 2
#> [8,] 1 2
#> [9,] 2 2
g2 <- make_lattice(c(3, 3, 3))
layout_on_grid(g2, dim = 3)
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 1 0 0
#> [3,] 2 0 0
#> [4,] 0 1 0
#> [5,] 1 1 0
#> [6,] 2 1 0
#> [7,] 0 2 0
#> [8,] 1 2 0
#> [9,] 2 2 0
#> [10,] 0 0 1
#> [11,] 1 0 1
#> [12,] 2 0 1
#> [13,] 0 1 1
#> [14,] 1 1 1
#> [15,] 2 1 1
#> [16,] 0 2 1
#> [17,] 1 2 1
#> [18,] 2 2 1
#> [19,] 0 0 2
#> [20,] 1 0 2
#> [21,] 2 0 2
#> [22,] 0 1 2
#> [23,] 1 1 2
#> [24,] 2 1 2
#> [25,] 0 2 2
#> [26,] 1 2 2
#> [27,] 2 2 2
plot(g, layout = layout_on_grid)
if (interactive() && requireNamespace("rgl", quietly = TRUE)) {
rglplot(g, layout = layout_on_grid(g, dim = 3))
}