Skip to contents

A render effect for stroked, point, and text marks, in the spirit of mplcyberpunk: a widened copy of the mark is drawn beneath the crisp original and softened with a real Gaussian blur (vellum's vl_viewport(blur=)), composited additively (a "screen" blend) into a soft neon halo. Pass it to a mark's effects argument, e.g. mark_line(..., effects = list(glow())). Pairs naturally with theme_cyberpunk().

Usage

glow(size = 6, layers = 6L, alpha = 0.12, blend = "screen", color = NULL)

Arguments

size

Halo spread in millimetres: the blur radius (and, for stroked/point marks, how much the copy is widened before blurring).

layers, blend

Retained for compatibility and the neon look: layers scales the halo opacity (it no longer stacks copies – one blurred layer replaces them), and blend (typically "screen"/"lighten") composites the halo.

alpha

Base halo opacity (scaled by layers).

color

Halo colour, or NULL (default) to inherit the mark's own resolved colour — the usual neon look.

Value

A GlowSpec object for a mark's effects list.

Details

The glow is applied per style group, so a colour-mapped multi-series line glows each series in its own hue. It applies to mark_point(), mark_line(), mark_step(), mark_rule(), mark_segment(), mark_edges(), mark_nodes(), mark_edge_bundle(), mark_flow_map(), and text marks (mark_text() / mark_label()); other marks reject it.

Examples

df <- data.frame(x = 1:20, y = cumsum(rnorm(20)))
vplot(df) |>
  mark_line(x = x, y = y, color = "#00e5ff", effects = list(glow())) |>
  theme_cyberpunk()