splot()
The one-function network plot
Pass any network — matrix, igraph, tna, edge list, cograph — and get a publication-ready plot. Customize with 100+ parameters for nodes, edges, labels, donuts, pies, confidence intervals, themes, and more. All in base R graphics.
6 Input Formats
12+ Node Shapes
Triple-Layer Donuts
CI & P-value Overlays
7 Themes
100+ Parameters
Nodes
node_size · node_shape · node_fill · node_border_color · node_alpha · scale_nodes_by
18 parameters
Edges
edge_color · edge_width · edge_alpha · curvature · arrow_size · edge_style
20 parameters
Donuts & Pies
donut_fill · donut_color · pie_values · pie_colors · donut2_values · donut_shape
22 parameters
Edge Labels
edge_labels · edge_label_style · edge_label_template · edge_label_p · edge_label_stars
25 parameters
Layout & Theme
layout · theme · background · seed · layout_scale · rescale
14 parameters
Output
filetype · filename · width · height · res · title
7 parameters
# That's it. One line.
splot(model)
splot() auto-detects the input type. Directionality is inferred from matrix symmetry or the source object. Override with directed.
| Parameter | Default | Description |
x | required | Network data: matrix, data.frame (edge list), igraph, cograph_network, tna, group_tna, bootstrap, or permutation object |
directed | NULL | Force directed/undirected. NULL = auto-detect from input |
i | NULL | Group index or name when x is group_tna. NULL = plot all groups in a grid |
Tip: Matrices with symmetric weights are treated as undirected. Edge lists default to directed. igraph/tna objects carry their own directionality.
| Parameter | Default | Description |
layout | "oval" | Layout algorithm or coordinate matrix |
seed | 42 | Random seed for reproducible layouts |
rescale | TRUE | Rescale layout to −1 to 1 range |
aspect | TRUE | Maintain aspect ratio |
Built-in layouts: "oval", "circle", "spring", "groups", "grid", "star", "bipartite". Or pass any igraph layout by name ("fr", "kk", "drl", "mds", "ni", "tr") or as a two-column matrix of x,y coordinates.
Example: Layouts
splot(mat, layout = "circle")
splot(mat, layout = "spring", seed = 123)
splot(mat, layout = "groups", groups = c("A","A","B","B","B"))
# igraph layout
splot(mat, layout = "kk")
# Custom coordinates
coords <- cbind(x = runif(10), y = runif(10))
splot(mat, layout = coords)
| Parameter | Default | Description |
title | NULL | Plot title |
title_size | 1.2 | Title font size |
background | "white" | Background color |
layout_scale | 1 | Scale factor: >1 expands, <1 contracts. "auto" scales by node count |
layout_margin | 0.15 | Margin as fraction of layout range |
margins | c(.1,.1,.1,.1) | Plot margins: c(bottom, left, top, right) |
scaling | "default" | "default" (qgraph-matched) or "legacy" (pre-v2.0) |
Node Aesthetics
Size, Shape & Color
| Parameter | Default | Description |
node_size | NULL | Node size. Scalar or per-node vector. Default 3 |
node_size2 | NULL | Secondary size for ellipse/rectangle height |
node_shape | "circle" | Shape name or per-node vector |
node_svg | NULL | Custom SVG: file path or inline string |
svg_preserve_aspect | TRUE | Maintain SVG aspect ratio |
node_fill | NULL | Fill color(s). Uses theme default if NULL |
node_border_color | NULL | Border color(s) |
node_border_width | 1 | Border width(s) |
node_alpha | 1 | Transparency (0–1) |
use_pch | FALSE | Use points() for simple circles (faster for large networks) |
Available shapes: "circle", "square", "triangle", "diamond", "pentagon", "hexagon", "star", "heart", "ellipse", "cross", "rectangle", "pie", plus any registered SVG shape.
Example: Node styling
# Per-node shapes and colors
splot(mat,
node_shape = c("circle", "hexagon", "diamond", "square", "star"),
node_fill = c("#E63946", "#457B9D", "#2A9D8F", "#E9C46A", "#F4A261"),
node_size = 8,
node_border_width = 2
)
# Custom SVG nodes
splot(mat, node_svg = "path/to/icon.svg", node_size = 10)
Centrality Scaling
Size nodes proportionally to any centrality measure. The value is computed internally — just pass the measure name.
| Parameter | Default | Description |
scale_nodes_by | NULL | Centrality measure name: "degree", "strength", "betweenness", "closeness", "eigenvector", "pagerank", "authority", "hub", "harmonic", "indegree", "outdegree", "instrength", "outstrength", … |
node_size_range | c(2, 8) | Output size range c(min, max) |
scale_nodes_scale | 1 | Dampening exponent. <1 compresses differences, >1 exaggerates |
Example: Size by centrality
# PageRank scaling
splot(mat, scale_nodes_by = "pagerank", node_size_range = c(3, 12))
# In-strength with dampening
splot(mat, scale_nodes_by = "instrength", scale_nodes_scale = 0.5)
Labels
| Parameter | Default | Description |
labels | TRUE | TRUE (use names), FALSE (none), or character vector |
label_size | NULL | Label text size (cex) |
label_color | "black" | Label color |
label_position | "center" | "center", "above", "below", "left", "right" |
label_fontface | "plain" | "plain", "bold", "italic", "bold.italic" |
label_fontfamily | "sans" | "sans", "serif", "mono" |
label_hjust | 0.5 | Horizontal justification (0=left, 1=right) |
label_vjust | 0.5 | Vertical justification (0=bottom, 1=top) |
label_angle | 0 | Rotation angle in degrees |
Donuts & Pies
Nodes can carry up to three data layers: an outer donut ring, an inner donut ring, and a pie chart core. Use these to encode multiple variables per node without cluttering the graph.
Donut Rings
| Parameter | Default | Description |
donut_fill | NULL | Fill proportion (0–1) per node. Scalar or vector |
donut_color | NULL | Fill color(s) for the ring. Scalar, vector, or list of vectors for segmented donuts |
donut_inner_ratio | 0.8 | Inner radius as fraction of outer (0–1). Smaller = thicker ring |
donut_bg_color | "gray90" | Background color for unfilled portion |
donut_shape | "circle" | Base shape: "circle", "square", "hexagon", "triangle", "diamond", "pentagon" |
donut_border_color | NULL | Border color. NULL inherits from node_border_color |
donut_border_width | NULL | Border width. NULL inherits from node_border_width |
donut_outer_border_color | NULL | Outer boundary color (enables double border) |
donut_line_type | "solid" | Line type: "solid", "dashed", "dotted" |
donut_empty | TRUE | Render empty rings for NA values |
Donut Value Display
| Parameter | Default | Description |
donut_show_value | FALSE | Show numeric value in donut center |
donut_value_size | 0.8 | Font size for center value |
donut_value_color | "black" | Color for center value |
donut_value_fontface | "bold" | Font face for center value |
donut_value_digits | 2 | Decimal places |
donut_value_prefix | "" | Text before value (e.g., "$") |
donut_value_suffix | "" | Text after value (e.g., "%") |
Example: Donut rings
# Simple progress ring
splot(mat, donut_fill = c(0.9, 0.7, 0.5), donut_color = "steelblue")
# Segmented donut (3 categories per node)
splot(mat,
donut_fill = lapply(1:5, function(i) c(runif(1), runif(1), runif(1))),
donut_color = list(c("#E63946", "#457B9D", "#2A9D8F")),
donut_inner_ratio = 0.6
)
# Hexagonal donut with value display
splot(mat,
donut_fill = c(0.85, 0.72, 0.93),
donut_color = "coral",
donut_shape = "hexagon",
donut_show_value = TRUE,
donut_value_suffix = "%",
donut_value_digits = 0
)
Pie Charts
| Parameter | Default | Description |
pie_values | NULL | List of numeric vectors: segment sizes per node |
pie_colors | NULL | Color vector or list of vectors for pie segments |
pie_border_width | NULL | Border width for slice dividers |
Example: Pie + Donut combo
splot(mat,
node_shape = "donut",
donut_fill = c(0.9, 0.7, 0.5),
donut_color = "steelblue",
pie_values = list(c(3,2,1), c(1,1,4), c(2,3,1)),
pie_colors = c("#E41A1C", "#377EB8", "#4DAF4A"),
node_size = 8
)
Double Donut
A second donut ring inside the first, for encoding a third data dimension.
| Parameter | Default | Description |
donut2_values | NULL | Values for inner donut ring |
donut2_colors | NULL | Colors for inner donut ring |
donut2_inner_ratio | 0.4 | Inner radius ratio for inner donut |
Example: Triple layer (donut + donut + pie)
splot(mat,
donut_fill = lapply(1:5, function(i) runif(3)),
donut_color = list(c("#E63946", "#457B9D", "#2A9D8F")),
donut_inner_ratio = 0.7,
donut2_values = as.list(runif(5, 0.4, 0.9)),
donut2_colors = list("#F4A261"),
donut2_inner_ratio = 0.45,
pie_values = lapply(1:5, function(i) sample(1:5, 4)),
pie_colors = list(c("#264653", "#E9C46A", "#F4A261", "#E76F51")),
node_size = 7
)
Edge Aesthetics
Color, Width & Style
| Parameter | Default | Description |
edge_color | NULL | Edge color(s). NULL = positive/negative coloring by weight sign |
edge_positive_color | "#2E7D32" | Color for positive weights |
edge_negative_color | "#C62828" | Color for negative weights |
edge_width | NULL | Edge width(s). NULL = scale by weight |
edge_alpha | 0.8 | Transparency (0–1) |
edge_style | 1 | Line type: 1=solid, 2=dashed, 3=dotted, etc. |
Weight Scaling
How edge weights map to visual width. The default is adaptive — it adjusts to network size and weight distribution.
| Parameter | Default | Description |
edge_size | NULL | Base size for weight scaling. NULL = adaptive: 15 * exp(-n/90) + 1 |
edge_width_range | c(0.1, 4) | Output width range c(min, max) |
edge_scale_mode | "linear" | Scaling: "linear", "log", "sqrt", or "rank" |
edge_cutoff | NULL | Two-tier width threshold. NULL = auto (75th percentile), 0 = disabled |
Note: edge_scale_mode = "log" is useful when weights span several orders of magnitude. "rank" equalizes spacing and is useful for heavy-tailed distributions.
Arrows & Curvature
| Parameter | Default | Description |
curvature | 0 | Edge curvature. 0 = straight |
curve_scale | TRUE | Auto-curve reciprocal edges |
curve_shape | 0 | Spline tension (−1 to 1) |
curve_pivot | 0.5 | Control point position along edge (0–1) |
curves | TRUE | TRUE = auto-curve reciprocals, FALSE = all straight, "force" = all curved |
arrow_size | 1 | Arrow head size |
arrow_angle | pi/6 | Arrow head angle (radians). Default = 30° |
show_arrows | TRUE | Show arrows on directed edges. Logical or per-edge vector |
bidirectional | FALSE | Arrows at both ends. Logical or per-edge vector |
loop_rotation | NULL | Self-loop direction angle(s) in radians |
Edge Start Style
A visual cue at the source end of directed edges — a dashed or dotted segment that indicates direction without relying solely on arrowheads.
| Parameter | Default | Description |
edge_start_style | "solid" | "solid", "dashed", or "dotted" |
edge_start_length | 0.15 | Fraction of edge length for styled segment (0–0.5) |
edge_start_dot_density | "12" | Dot pattern: two-char string (dot length, gap length) |
Edge Labels
Basic Labels
| Parameter | Default | Description |
edge_labels | FALSE | TRUE (show weights), FALSE (none), or character vector |
edge_label_size | 0.8 | Label text size |
edge_label_color | "gray30" | Text color |
edge_label_bg | NA | Background color for label box |
edge_label_position | 0.5 | Position along edge (0=source, 1=target) |
edge_label_offset | 0 | Perpendicular offset (positive = above curve) |
edge_label_fontface | "plain" | Font face |
edge_label_halo | TRUE | White halo for readability |
edge_label_digits | 2 | Decimal places for numeric values |
edge_label_leading_zero | TRUE | Show leading zero for values < 1 |
edge_label_oneline | TRUE | Single line format |
Shadow
| Parameter | Default | Description |
edge_label_shadow | FALSE | Enable drop shadow |
edge_label_shadow_color | "gray40" | Shadow color |
edge_label_shadow_offset | 0.5 | Shadow offset in points |
edge_label_shadow_alpha | 0.5 | Shadow transparency |
Templates & Styles
The template system composes edge labels from multiple data sources. Use preset styles or build your own with placeholders.
| Parameter | Default | Description |
edge_label_style | "none" | Preset: "none", "estimate", "full", "range", "stars" |
edge_label_template | NULL | Custom template with placeholders. Overrides edge_label_style |
Template placeholders: {est} = estimate, {low} = lower CI, {up} = upper CI, {range} = [low, up], {p} = p-value, {stars} = significance stars.
| Style | Produces |
"estimate" | .23 |
"full" | .23 [.18, .29]* |
"range" | [.18, .29] |
"stars" | *** |
Example: Custom template
# Effect size with stars
splot(mat,
edge_labels = TRUE,
edge_label_template = "{est}{stars}",
edge_label_p = pval_matrix,
edge_label_stars = TRUE,
edge_label_leading_zero = FALSE
)
# Full annotation
splot(mat,
edge_label_style = "full",
edge_ci_lower = ci_lo,
edge_ci_upper = ci_hi,
edge_label_p = pvals,
edge_label_stars = TRUE
)
Confidence Intervals & P-values
Overlay confidence intervals as semi-transparent bands on edges, and annotate with p-values and significance stars.
| Parameter | Default | Description |
edge_ci | NULL | CI width vector (0–1). Rendered as semi-transparent underlay |
edge_ci_scale | 2.0 | Width multiplier for underlay thickness |
edge_ci_alpha | 0.15 | Underlay transparency |
edge_ci_color | NA | Underlay color. NA = match edge color |
edge_ci_style | 2 | Underlay line type: 1=solid, 2=dashed, 3=dotted |
edge_ci_arrows | FALSE | Show arrows on underlay |
edge_ci_lower | NULL | Lower CI bounds (for label annotation) |
edge_ci_upper | NULL | Upper CI bounds (for label annotation) |
edge_label_p | NULL | P-values per edge |
edge_label_p_digits | 3 | Decimal places for p-values |
edge_label_p_prefix | "p=" | Prefix for p-value display |
edge_label_stars | NULL | Significance stars: TRUE (compute from p), character vector, or numeric (treated as p-values) |
edge_label_ci_format | "bracket" | "bracket" [low, up] or "dash" low–up |
edge_priority | NULL | Render priority per edge. Higher = drawn on top |
Example: Full statistical annotation
splot(mat,
edge_ci_lower = ci_lower_matrix,
edge_ci_upper = ci_upper_matrix,
edge_label_p = pvalue_matrix,
edge_label_stars = TRUE,
edge_label_style = "full",
edge_label_leading_zero = FALSE,
edge_label_color = "#800020"
)
Weight Handling
| Parameter | Default | Description |
threshold | 0 | Minimum absolute weight to display an edge |
minimum | 0 | Alias for threshold (qgraph compatibility). Uses max(threshold, minimum) |
maximum | NULL | Maximum weight for scaling. NULL = auto from data |
weight_digits | 2 | Decimal places to round weights. Edges rounding to 0 are removed. NULL = disable |
edge_duplicates | NULL | Handle duplicate edges in undirected networks: "sum", "mean", "first", "max", "min", or custom function |
Themes & Legend
Built-in Themes
| Parameter | Default | Description |
theme | NULL | Theme name. NULL = default styling |
Available themes: "classic" (white bg, blue nodes), "dark" (dark bg for slides), "minimal" (subtle, thin edges), "colorblind" (CVD-optimized), "gray" (grayscale), "nature" (earth tones), "viridis" (viridis palette). Register custom themes with register_theme().
Legend
| Parameter | Default | Description |
legend | FALSE | Show legend |
legend_position | "topright" | "topright", "topleft", "bottomright", "bottomleft" |
legend_size | 0.8 | Legend text size |
legend_edge_colors | TRUE | Show positive/negative edge colors |
legend_node_sizes | FALSE | Show node size scale |
groups | NULL | Group assignments for node coloring and legend entries |
node_names | NULL | Alternative names for legend (separate from plot labels) |
Output & Saving
| Parameter | Default | Description |
filetype | "default" | "default" (screen), "png", "pdf", "svg", "jpeg", "tiff" |
filename | tempdir() | Output path (without extension) |
width | 7 | Width in inches |
height | 7 | Height in inches |
res | 600 | Resolution (DPI) for raster formats |
Example: Save to file
# Save as PDF
splot(mat, filetype = "pdf", filename = "network", width = 10, height = 8)
# Save as high-res PNG
splot(mat, filetype = "png", filename = "network", width = 10, height = 8, res = 300)
S3 Methods: splot has specialized methods for tna_bootstrap (solid/dashed by significance, stars on labels), tna_permutation (green/red by group direction), and group_tna_permutation objects. These add parameters like display, show_ci, show_stars, and width_by on top of the full parameter set above.