Skip to contents

as_svg() draws a graph to a standalone SVG string using the same geometry as plot.igraph(), but emits per-vertex <g id="vertex-N"> groups with <title> tooltips (and per-edge groups), giving lightweight interactivity (hover) with no JavaScript. It accepts the usual plotting parameters via ....

Usage

as_svg(graph, ..., file = NULL, width = 7, height = 7, tooltips = NULL)

Arguments

graph

The graph to plot.

...

Plotting parameters passed to plot.igraph().

file

Optional path to write the SVG to. If NULL (default) the SVG string is returned invisibly.

width, height

Size in inches (the SVG is width*72 x height*72 px).

tooltips

Optional vertex attribute name to use for the <title> tooltips; defaults to the vertex name attribute (or vertex index).

Value

The SVG string, invisibly (also written to file if given).

Details

Vertices, edges (all styles, with their line types), arrowheads, labels (with their font family and face), mark groups, pie shapes and the legends of scale_vertex_color() and friends are rendered; sphere/raster vertex shapes are drawn as a placeholder box in this version. Axes, titles and frames are not included.

vcount()