Learn R Programming

igraph (version 1.0.1)

layout_on_grid: Simple grid layout

Description

This layout places vertices on a rectangulat grid, in two or three dimensions.

Usage

layout_on_grid(graph, width = 0, height = 0, dim = 2)

on_grid(...)

layout.grid.3d(graph, width = 0, height = 0)

Arguments

graph

The input graph.

width

The number of vertices in a single row of the grid. If this is zero or negative, then for 2d layouts the width of the grid will be the square root of the number of vertices in the graph, rounded up to the next integer. Similarly, it will be the cube root for 3d layouts.

height

The number of vertices in a single column of the grid, for three dimensional layouts. If this is zero or negative, then it is determinted automatically.

dim

Two or three. Whether to make 2d or a 3d layout.

...

Passed to layout_on_grid.

Value

A two-column or three-column matrix.

Details

The function places the vertices on a simple rectangular grid, one after the other. If you want to change the order of the vertices, then see the permute function.

See Also

layout for other layout generators

Other graph layouts: add_layout_; as_bipartite, layout.bipartite, layout_as_bipartite; as_star, layout.star, layout_as_star; as_tree, layout_as_tree; component_wise; in_circle, layout_in_circle; layout.auto, layout_nicely, nicely; layout.davidson.harel, layout_with_dh, with_dh; layout.gem, layout_with_gem, with_gem; layout.graphopt, layout_with_graphopt, with_graphopt; layout.mds, layout_with_mds, with_mds; layout.merge, layout_components, merge_coords, piecewise.layout, piecewise.layout; layout.norm, norm_coords; layout.sugiyama, layout_with_sugiyama, with_sugiyama; layout_on_sphere, on_sphere; layout_randomly, randomly; layout_with_fr, with_fr; layout_with_kk, with_kk; layout_with_lgl, with_lgl; layout, layout_, print.igraph_layout_modifier, print.igraph_layout_spec; normalize

Examples

Run this code
# NOT RUN {
g <- make_lattice( c(3,3) )
layout_on_grid(g)

g2 <- make_lattice( c(3,3,3) )
layout_on_grid(g2, dim = 3)

# }
# NOT RUN {
plot(g, layout=layout_on_grid)
rglplot(g, layout=layout_on_grid(g, dim = 3))
# }

Run the code above in your browser using DataLab