View source: R/layout_igraph.R
layout_tbl_graph_igraph | R Documentation |
This layout function makes it easy to apply one of the layout algorithms
supplied in igraph when plotting with ggraph. Layout names are auto completed
so there is no need to write layout_with_graphopt
or
layout_as_tree
, just graphopt
and tree
(though the
former will also work if you want to be super explicit). Circular layout is
only supported for tree-like layout (tree
and sugiyama
) and
will throw an error when applied to other layouts.
layout_tbl_graph_igraph(
graph,
algorithm,
circular,
offset = pi/2,
use.dummy = FALSE,
...
)
graph |
A |
algorithm |
The type of layout algorithm to apply. See Details or
|
circular |
Logical. Should the layout be transformed to a circular
representation. Defaults to |
offset |
If |
use.dummy |
Logical. In the case of |
... |
Arguments passed on to the respective layout functions |
igraph provides a huge amount of possible layouts. They are all briefly described below:
Hierarchical layouts
tree
Uses the Reingold-Tilford algorithm to place the
nodes below their parent with the parent centered above its children. See
igraph::as_tree()
sugiyama
Designed for directed acyclic graphs (that is,
hierarchies where multiple parents are allowed) it minimizes the number of
crossing edges. See igraph::with_sugiyama()
Standard layouts
bipartite
Minimize edge-crossings in a simple two-row (or
column) layout for bipartite graphs. See igraph::as_bipartite()
star
Place one node in the center and the rest equidistantly
around it. See igraph::as_star()
circle
Place nodes in a circle in the order of their index.
Consider using layout_tbl_graph_linear()
with circular=TRUE
for more control. See igraph::in_circle()
nicely
Tries to pick an appropriate layout. See
igraph::nicely()
for a description of the simple decision tree
it uses
dh
Uses Davidson and Harels simulated annealing
algorithm to place nodes. See igraph::with_dh()
gem
Place nodes on the plane using the GEM force-directed
layout algorithm. See igraph::with_gem()
graphopt
Uses the Graphopt algorithm based on alternating
attraction and repulsion to place nodes. See
igraph::with_graphopt()
grid
Place nodes on a rectangular grid. See
igraph::on_grid()
mds
Perform a multidimensional scaling of nodes using either
the shortest path or a user supplied distance. See
igraph::with_mds()
sphere
Place nodes uniformly on a sphere - less relevant for
2D visualizations of networks. See igraph::on_sphere()
randomly
Places nodes uniformly random. See
igraph::randomly()
fr
Places nodes according to the force-directed algorithm of
Fruchterman and Reingold. See igraph::with_fr()
kk
Uses the spring-based algorithm by Kamada and Kawai to
place nodes. See igraph::with_kk()
drl
Uses the force directed algorithm from the DrL toolbox to
place nodes. See igraph::with_drl()
lgl
Uses the algorithm from Large Graph Layout to place
nodes. See igraph::with_lgl()
A data.frame with the columns x
, y
, circular
as
well as any information stored as node variables in the tbl_graph object.
This function is not intended to be used directly but by setting
layout = 'igraph'
in create_layout()
Other layout_tbl_graph_*:
layout_tbl_graph_auto()
,
layout_tbl_graph_backbone()
,
layout_tbl_graph_cactustree()
,
layout_tbl_graph_centrality()
,
layout_tbl_graph_circlepack()
,
layout_tbl_graph_dendrogram()
,
layout_tbl_graph_eigen()
,
layout_tbl_graph_fabric()
,
layout_tbl_graph_focus()
,
layout_tbl_graph_hive()
,
layout_tbl_graph_htree()
,
layout_tbl_graph_linear()
,
layout_tbl_graph_manual()
,
layout_tbl_graph_matrix()
,
layout_tbl_graph_metro()
,
layout_tbl_graph_partition()
,
layout_tbl_graph_pmds()
,
layout_tbl_graph_sf()
,
layout_tbl_graph_stress()
,
layout_tbl_graph_treemap()
,
layout_tbl_graph_unrooted()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.