Learn R Programming

rgexf (version 0.17.0)

plot.gexf: 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 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

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

Run the code above in your browser using DataLab