Skip to contents

Embed a passive SVG illustration behind a schematic network.

Usage

set_background(x, file)

Arguments

x

An atlas object.

file

Local SVG filename. Its root viewBox must be exactly "0 0 1000 650" and it must use the supported passive SVG subset.

Details

Add schematic nodes before setting a background. The illustration is embedded in the HTML and requires no external file when viewed. The browser can toggle its visibility, and visible artwork is included in SVG and PNG exports. An illustration does not imply geographic node positions. The ggplot2 adapter omits this illustration with a warning and retains the supplied schematic node positions.

Supported SVG elements are svg, g, defs, path, rect, circle, ellipse, line, polyline, polygon, use, text, tspan, title and desc. References must be local fragments. External resources, scripts, style attributes, event attributes, DOCTYPE declarations, entities and processing instructions are rejected.

Value

An offline_atlas object, suitable for piping into another configuration function or export_html.

See also

add_nodes, set_controls, export_html.

For the tutorial, see the offlineatlas package overview.

Examples

families <- example_data("florence_nodes")
m <- atlas("Florentine families") |>
  add_nodes(families, "id", "label", layout_x = "x", layout_y = "y",
            coordinates = "schematic")
m <- set_background(m, example_file("florence.svg"))