This function tries to choose an appropriate graph layout algorithm for the graph, automatically, based on a simple algorithm. See details below.
layout_nicely(graph, dim = 2, ...) nicely(...)
The input graph
Dimensions, should be 2 or 3.
layout_nicely() tries to choose an appropriate layout function for the
supplied graph, and uses that to generate the layout. The current
implementation works like this:
If the graph has a graph attribute called ‘layout’, then this is used. If this attribute is an R function, then it is called, with the graph and any other extra arguments.
Otherwise, if the graph has vertex attributes called ‘x’ and ‘y’, then these are used as coordinates. If the graph has an additional ‘z’ vertex attribute, that is also used.
if the graph is connected and has less than 1000 vertices, the
Fruchterman-Reingold layout is used, by calling
Otherwise the DrL layout is used,
layout_with_drl() is called.
In layout algorithm implementations, an argument named ‘weights’ is
typically used to specify the weights of the edges if the layout algorithm
supports them. In this case, omitting ‘weights’ or setting it to
NULL will make igraph use the 'weight' edge attribute from the graph
if it is present. However, most layout algorithms do not support non-positive
layout_nicely() would fail if you simply called it on
your graph without specifying explicit weights and the weights happened to
include non-positive numbers. We strive to ensure that
works out-of-the-box for most graphs, so the rule is that if you omit
‘weights’ or set it to
end up calling
layout_with_drl(), we do not
forward the weights to these functions and issue a warning about this. You
weights = NA to silence the warning.
A numeric matrix with two or three columns.
Gabor Csardi firstname.lastname@example.org
Other graph layouts:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.