format-comma
Shorthand for format-number(big-mark: ",").
Usage
format-comma(
digits: auto,
prefix: "",
suffix: "",
)Parameters
| Parameter | Default | Description |
|---|---|---|
digits |
auto |
Decimal digits to keep, or auto to drop trailing zeros. |
prefix |
"" |
String prepended to every formatted value. |
suffix |
"" |
String appended to every formatted value. |
Returns
A closure value => string.
Examples
Thread format-comma() into scale-y-continuous(labels: ...) so y-axis breaks render with English thousands separators.
#plot(
data: ((x: 1, y: 1234), (x: 2, y: 23456), (x: 3, y: 345678)),
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 3pt),),
scales: (scale-y-continuous(labels: format-comma()),),
width: 10cm,
height: 6cm,
)