Learn R Programming

g6R (version 0.1.0)

fruchterman_layout: Generate G6 Fruchterman layout configuration

Description

This function creates a configuration list for G6 Fruchterman layout with all available options as parameters.

Usage

fruchterman_layout(height = NULL, width = NULL, gravity = 10, speed = 5, ...)

Value

A list containing the configuration for G6 fruchterman layout.

Arguments

height

Numeric. Layout height. Defaults to container height.

width

Numeric. Layout width. Defaults to container width.

gravity

Numeric. Central force attracting nodes to the center. Larger values make the layout more compact. Defaults to 10.

speed

Numeric. Node movement speed per iteration. Higher values may cause oscillation. Defaults to 5.

...

Additional parameters to pass to the layout. See https://g6.antv.antgroup.com/en/manual/layout/fruchterman-layout.

Examples

Run this code
if (interactive()) {
  g6(lesmis$nodes, lesmis$edges) |>
   g6_layout(fruchterman_layout(
     gravity = 5,
     speed = 5
   )) |>
   g6_behaviors(
     "zoom-canvas",
     drag_element()
   )
}

Run the code above in your browser using DataLab