scale-stroke-manual

Manual discrete stroke scale: supply a per-level array of Typst lengths.

Usage

scale-stroke-manual(
  values: (),
  name: none,
  limits: none,
  labels: auto,
)

Parameters

Parameter Default Description
values () Array of Typst lengths, one per level.
name none Legend title.
limits none Array of level names controlling order and inclusion, or none.
labels auto Array of legend labels aligned with limits, or auto.

Returns

Scale object consumed by plot.

Examples

Three explicit thickness lengths pinned to three named levels via values and limits.

#let d = (
  (x: 1, y: 1, g: "thin"),
  (x: 2, y: 2, g: "thin"),
  (x: 1, y: 2, g: "medium"),
  (x: 2, y: 3, g: "medium"),
  (x: 1, y: 3, g: "thick"),
  (x: 2, y: 4, g: "thick"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", stroke: "g"),
  layers: (geom-point(size: 6pt, fill: rgb("#1f77b4")),),
  scales: (
    scale-stroke-manual(
      values: (0.2pt, 0.8pt, 2pt),
      limits: ("thin", "medium", "thick"),
    ),
  ),
  width: 10cm,
  height: 6cm,
)

Scatter chart with six blue markers across three groups (thin, medium, thick) whose outline thicknesses come from a manual length array pinned by limits.

Scatter chart with six blue markers across three groups (thin, medium, thick) whose outline thicknesses come from a manual length array pinned by limits.

See also

scale-stroke-continuous, scale-linewidth-manual.

Back to top