Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

graphLayout

Generate Graph Layout


Description

This function generates plot coordinates for each variable in a graph that does not have them already. To this end, the well-known “Spring” layout algorithm is used. Note that this is a stochastic algorithm, so the generated layout will be different every time (which also means that you can try several times until you find a decent layout).

Usage

graphLayout(x, method = "spring")

Arguments

x

the input graph, of any type.

method

the layout method; currently, only "spring" is supported.

Value

the same graph as x but with layout coordinates added.

Examples

## Generate a layout for the M-bias graph and plot it
plot( graphLayout( dagitty( "dag { X <- U1 -> M <- U2 -> Y } " ) ) )
## Plot larger graph and abbreviate its variable names.
plot( getExample("Shrier"), abbreviate.names=TRUE )

dagitty

Graphical Analysis of Structural Causal Models

v0.3-1
GPL-2
Authors
Johannes Textor, Benito van der Zander, Ankur Ankan
Initial release
2021-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.