layout_with_fr | R Documentation |
Place vertices on the plane using the force-directed layout algorithm by Fruchterman and Reingold.
layout_with_fr(
graph,
coords = NULL,
dim = 2,
niter = 500,
start.temp = sqrt(vcount(graph)),
grid = c("auto", "grid", "nogrid"),
weights = NULL,
minx = NULL,
maxx = NULL,
miny = NULL,
maxy = NULL,
minz = NULL,
maxz = NULL,
coolexp = deprecated(),
maxdelta = deprecated(),
area = deprecated(),
repulserad = deprecated(),
maxiter = deprecated()
)
with_fr(...)
See the referenced paper below for the details of the algorithm.
This function was rewritten from scratch in igraph version 0.8.0.
A two- or three-column matrix, each row giving the coordinates of a vertex, according to the ids of the vertex ids.
Gabor Csardi csardi.gabor@gmail.com
Fruchterman, T.M.J. and Reingold, E.M. (1991). Graph Drawing by Force-directed Placement. Software - Practice and Experience, 21(11):1129-1164.
layout_with_drl()
, layout_with_kk()
for
other layout algorithms.
Other graph layouts:
add_layout_()
,
component_wise()
,
layout_()
,
layout_as_bipartite()
,
layout_as_star()
,
layout_as_tree()
,
layout_in_circle()
,
layout_nicely()
,
layout_on_grid()
,
layout_on_sphere()
,
layout_randomly()
,
layout_with_dh()
,
layout_with_gem()
,
layout_with_graphopt()
,
layout_with_kk()
,
layout_with_lgl()
,
layout_with_mds()
,
layout_with_sugiyama()
,
merge_coords()
,
norm_coords()
,
normalize()
# Fixing ego
g <- sample_pa(20, m = 2)
minC <- rep(-Inf, vcount(g))
maxC <- rep(Inf, vcount(g))
minC[1] <- maxC[1] <- 0
co <- layout_with_fr(g,
minx = minC, maxx = maxC,
miny = minC, maxy = maxC
)
co[1, ]
plot(g,
layout = co, vertex.size = 30, edge.arrow.size = 0.2,
vertex.label = c("ego", rep("", vcount(g) - 1)), rescale = FALSE,
xlim = range(co[, 1]), ylim = range(co[, 2]), vertex.label.dist = 0,
vertex.label.color = "red"
)
axis(1)
axis(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.