Skip to contents

Creates an htmlwidget that renders a GEXF graph using sigma.js v3 and graphology. Node positions, colours, and sizes are read from the viz:* attributes embedded in the GEXF document. Nodes are drawn with a thin border ring whose colour is controlled by borderColor.

Usage

sigmajs(
  gexf = system.file("gexf-graphs/lesmiserables.gexf", package = "rgexf"),
  width = NULL,
  height = NULL,
  borderColor = NULL,
  borderSize = 0.15
)

sigmajsOutput(outputId, width = "100%", height = "400px")

renderSigmajs(expr, env = parent.frame(), quoted = FALSE)

Arguments

gexf

Either a gexf object, or a path to a .gexf file. Defaults to the bundled Les Misérables example.

width, height

Widget dimensions in pixels. Defaults to NULL, in which case the widget spans the full available width and is 450px tall.

borderColor

A CSS colour string for the node border ring. Defaults to NULL (no border — sigma.js's default plain filled circle). Set to a colour such as "#ffffff" to add a ring.

borderSize

Border ring thickness as a fraction of the node radius (0–1). Only used when borderColor is set. Defaults to 0.15 (15 %).

outputId

Shiny output ID.

expr

An expression that returns a sigmajs widget.

env

The environment in which to evaluate expr.

quoted

Logical scalar. Is expr a quoted expression?

Value

An htmlwidget object.

Examples

if (interactive()) {
  path <- system.file("gexf-graphs/lesmiserables.gexf", package = "rgexf")
  sigmajs(path)

  # White border ring
  sigmajs(path, borderColor = "#ffffff", borderSize = 0.15)
}