layout.forceatlas2 | R Documentation |
This function applies Jacomy et al. (2014)'s 'ForceAtlas2' layout algorithm to an igraph
object.
layout.forceatlas2(
g,
iterations = 100,
linlog = FALSE,
pos = NULL,
gravity = 1,
center = NULL,
plotstep = 10,
plotlabels = TRUE,
scalingratio = 10,
stronggravity = FALSE,
jittertol = 1
)
g |
An |
iterations |
Integer. The number of iterations to run the algorithm. Default is 100. |
linlog |
Logical. If |
pos |
A 2-column matrix of initial positions, where the columns contain x-coordinates and y-coordinates, respectively. If |
gravity |
Numeric. The strength of the gravity force. Default is 1. Note that this is only included in calculations if |
center |
A numeric vector of length 2 specifying the center of gravity. If |
plotstep |
Integer. The number of iterations between plots. If |
plotlabels |
Logical. If |
scalingratio |
Numeric. The scaling ratio of the layout. Default is 10, in line with ‘Gephi’. |
stronggravity |
Logical. If |
jittertol |
Numeric. The tolerance for jittering nodes. Default is |
This function implements Jacomy et al. (2014)'s ForceAtlas2 layout algorithm on an igraph
object.
It can handle large graphs and is particularly suitable for visualizing networks. It also includes LinLog mode and a stronger gravity feature, like ‘Gephi’.
A matrix of node positions.
jacomy_forceatlas2_2014GephiForR
\insertRefnoack_modularity_2009GephiForR
# Create a random graph
library(igraph)
g <- erdos.renyi.game(100, 0.05)
# Assign non-numeric row names
V(g)$name <- paste0("node", 1:vcount(g))
# Apply ForceAtlas2 layout
pos <- layout.forceatlas2(g, linlog = TRUE, iterations = 100, scalingratio = 10)
plot(g, layout = pos)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.