register_svg_shape: Register Custom SVG Shape

View source: R/shapes-svg.R

register_svg_shapeR Documentation

Register Custom SVG Shape

Description

Register an SVG file or string as a custom node shape.

Usage

register_svg_shape(name, svg_source)

Arguments

name

Character: unique name for this shape (used in node_shape parameter).

svg_source

Character: path to SVG file OR inline SVG string.

Value

Invisible NULL. The shape is registered for use with sn_nodes().

Examples

## Not run: 
# Register from file
register_svg_shape("custom_icon", "path/to/icon.svg")

# Register from inline SVG
register_svg_shape("simple_star",
  '<svg viewBox="0 0 100 100">
    <polygon points="50,5 20,99 95,39 5,39 80,99" fill="currentColor"/>
  </svg>')

# Use in network
cograph(adj) |> sn_nodes(shape = "custom_icon")

## End(Not run)

cograph documentation built on April 1, 2026, 1:07 a.m.