Skip to contents

A render effect for stroked and point marks, in the spirit of mplcyberpunk: the mark is drawn as several widened, low-opacity copies composited additively (a "screen" blend) beneath the crisp original, producing 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

Extra visual spread, in millimetres, added to the stroke width (or point diameter) at the outermost copy.

layers

Number of stacked halo copies.

alpha

Opacity of each copy (they accumulate toward the centre).

blend

Blend mode compositing the halo copies, typically "screen" or "lighten" (any CSS mix-blend-mode name).

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(), and mark_nodes(); other marks reject it with an error.

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()