plot.gexf: Visualizing GEXF graphs using sigma.js (default) or gexf-js

View source: R/plot.R

plot.gexfR Documentation

Visualizing GEXF graphs using sigma.js (default) or gexf-js

Description

plot.gexf renders a gexf object as an interactive sigma.js htmlwidget. For the legacy gexf-js file-server approach, use plot_gexfjs.

Usage

## S3 method for class 'gexf'
plot(x, y = NULL, width = NULL, height = NULL, ...)

Arguments

x

An object of class gexf.

y

Ignored.

width, height

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

...

Additional arguments forwarded to sigmajs() (e.g. borderColor, borderSize).

Details

plot.gexf delegates to sigmajs, which produces an htmlwidget powered by sigma.js. Node positions, colours, and sizes are read directly from the GEXF ⁠viz:*⁠ attributes, so the graph must contain them. If they are absent you can round-trip through igraph:

x <- igraph.to.gexf(gexf.to.igraph(x))
plot(x)

See Also

sigmajs(), plot_gexfjs()

Examples

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


rgexf documentation built on July 24, 2026, 1:07 a.m.