View source: R/layout_scaling.R
| layout_scaling | R Documentation |
The "scaling" layout places nodes by multidimensional scaling, so that the distance drawn between two nodes approximates the number of steps of the shortest path between them. Unlike a force-directed layout, then, the coordinates can be read, and so this layout draws labelled axes, at a fixed ratio so that the two axes share one scale.
Which algorithm is used depends on the size of the network.
Up to a hundred nodes, classical multidimensional scaling is used,
as igraph::layout_with_mds() offers it.
Above that, or where pivots is given,
pivot multidimensional scaling is used instead,
as graphlayouts::layout_with_pmds() offers it,
which approximates the same solution from a sample of the nodes
and is much the faster for a large network.
Note that "mds" and "pmds" remain available as layouts in their own right,
though "pmds" then requires its own pivots.
Two dimensions rarely hold every path distance of a network at once,
so graphr() captions the plot with how well this one does:
see check_stress() for how to read the score.
layout_scaling(.data, pivots = NULL, circular = FALSE, times = 1)
layout_tbl_graph_scaling(.data, pivots = NULL, circular = FALSE, times = 1)
.data |
Some |
pivots |
The number of nodes to approximate the scaling from.
By default this is |
circular |
Should the layout be transformed into a radial
representation. Only possible for some layouts. Defaults to FALSE.
Required for |
times |
Maximum number of iterations, where appropriate.
Required for |
The distances scaled are those of the unweighted network, that is, the number of ties on the shortest path between two nodes. Tie weights are ignored, since the interpretation of a drawn distance is then the same whatever the network, and since a signed network has no shortest paths to speak of.
Where a network is disconnected, there is no path between its components, and so no distance to scale. Each component is laid out and the components are then placed beside one another, and the fit is reported over the pairs of nodes that a path does connect.
Returns a table of nodes' x and y coordinates.
Kruskal, Joseph B. 1964. "Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis", Psychometrika 29(1): 1-27. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02289565")}
Brandes, Ulrik, and Christian Pich. 2007. "Eigensolver methods for progressive multidimensional scaling of large data", in Graph Drawing, 42-53. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-540-70904-6_6")}
Other mapping:
check_layout,
completion,
layout_concentric(),
layout_configuration(),
layout_correspondence(),
layout_layered(),
layout_levels(),
layout_matching(),
layout_spatial(),
layout_valence(),
plot_graphr,
plot_graphs,
plot_grapht
graphr(manynet::ison_southern_women, layout = "scaling")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.