API reference#
Predefined string variables#
Names below are ordinary string variables, available without declarations. User bindings take priority; the equivalent quoted value remains legal. Contextual meaning belongs to parameter documentation, not variable hover.
| Variable | Type | String value |
|---|---|---|
auto |
string |
"auto" |
axes |
string |
"axes" |
bar |
string |
"bar" |
bevel |
string |
"bevel" |
both |
string |
"both" |
bottom |
string |
"bottom" |
bottom_center |
string |
"bottom_center" |
bottom_left |
string |
"bottom_left" |
bottom_right |
string |
"bottom_right" |
boundary |
string |
"boundary" |
box |
string |
"box" |
butt |
string |
"butt" |
cartesian |
string |
"cartesian" |
center |
string |
"center" |
centered |
string |
"centered" |
chord |
string |
"chord" |
circle |
string |
"circle" |
cm |
string |
"cm" |
contain |
string |
"contain" |
container |
string |
"container" |
count |
string |
"count" |
cover |
string |
"cover" |
cross |
string |
"cross" |
dash |
string |
"dash" |
dash_dot |
string |
"dash_dot" |
dashed |
string |
"dashed" |
deg |
string |
"deg" |
density |
string |
"density" |
diamond |
string |
"diamond" |
display |
string |
"display" |
dot |
string |
"dot" |
dots |
string |
"dots" |
dotted |
string |
"dotted" |
double |
string |
"double" |
end |
string |
"end" |
evenodd |
string |
"evenodd" |
horizontal |
string |
"horizontal" |
in |
string |
"in" |
inch |
string |
"inch" |
incoming |
string |
"incoming" |
inline |
string |
"inline" |
inout |
string |
"inout" |
italic |
string |
"italic" |
justify |
string |
"justify" |
left |
string |
"left" |
linear |
string |
"linear" |
local |
string |
"local" |
log |
string |
"log" |
long_dash |
string |
"long_dash" |
lower |
string |
"lower" |
major |
string |
"major" |
mathjax_newcm |
string |
"mathjax-newcm" |
mathjax_tex |
string |
"mathjax-tex" |
mid |
string |
"mid" |
middle_left |
string |
"middle_left" |
middle_right |
string |
"middle_right" |
miter |
string |
"miter" |
mm |
string |
"mm" |
none |
string |
"none" |
nonzero |
string |
"nonzero" |
normal |
string |
"normal" |
offset |
string |
"offset" |
open |
string |
"open" |
out |
string |
"out" |
outgoing |
string |
"outgoing" |
parent |
string |
"parent" |
plain |
string |
"plain" |
plot_bottom_center |
string |
"plot_bottom_center" |
plot_bottom_left |
string |
"plot_bottom_left" |
plot_bottom_right |
string |
"plot_bottom_right" |
plot_center |
string |
"plot_center" |
plot_middle_left |
string |
"plot_middle_left" |
plot_middle_right |
string |
"plot_middle_right" |
plot_top_center |
string |
"plot_top_center" |
plot_top_left |
string |
"plot_top_left" |
plot_top_right |
string |
"plot_top_right" |
polar |
string |
"polar" |
post |
string |
"post" |
pre |
string |
"pre" |
probability |
string |
"probability" |
pt |
string |
"pt" |
px |
string |
"px" |
rad |
string |
"rad" |
radar |
string |
"radar" |
raster |
string |
"raster" |
ratex_katex |
string |
"ratex-katex" |
raw |
string |
"raw" |
right |
string |
"right" |
round |
string |
"round" |
scientific |
string |
"scientific" |
shortest |
string |
"shortest" |
single |
string |
"single" |
slash |
string |
"slash" |
solid |
string |
"solid" |
square |
string |
"square" |
start |
string |
"start" |
stealth |
string |
"stealth" |
stretch |
string |
"stretch" |
symlog |
string |
"symlog" |
target |
string |
"target" |
top |
string |
"top" |
top_center |
string |
"top_center" |
top_left |
string |
"top_left" |
top_right |
string |
"top_right" |
triangle |
string |
"triangle" |
triangle_down |
string |
"triangle_down" |
triple |
string |
"triple" |
upper |
string |
"upper" |
vector |
string |
"vector" |
vertical |
string |
"vertical" |
x |
string |
"x" |
y |
string |
"y" |
outer |
string |
"outer" |
inner |
string |
"inner" |
content |
string |
"content" |
object |
string |
"object" |
arc |
string |
"arc" |
wave |
string |
"wave" |
perspective |
string |
"perspective" |
document#
Create a .laydoc document; doc.add(page) determines page order.
Returns: Create a .laydoc document; doc.add(page) determines page order.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Document name | "Untitled" |
transition |
transition|string | Entering transition; page overrides document default, none disables, omitted inherits LCSS | — |
Minimal complete example#
# Each page remains an ordinary, independently renderable .lay file.doc = document(name="LayMesh multi-page report")pages = [ page(src="./pages/cover.lay", id="cover", name="封面 / Cover"), page(src="./pages/results.lay", id="results", name="结果 / Results"), page(src="./pages/summary.lay", id="summary", name="总结 / Summary"),] # Move entries in the list to reorder the document.for p in pages { doc.add(p)}Concepts and common errors · Composition source
page#
Reference an independent .lay page; compilation and asset paths belong to that page.
Returns: Reference an independent .lay page; compilation and asset paths belong to that page.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local .lay path relative to the calling file | — |
id |
string | Stable unique page ID; defaults to the file stem | — |
name |
string | Display name; defaults to id | — |
transition |
transition|string | Entering transition; page overrides document default, none disables, omitted inherits LCSS | — |
Minimal complete example#
# Each page remains an ordinary, independently renderable .lay file.doc = document(name="LayMesh multi-page report")pages = [ page(src="./pages/cover.lay", id="cover", name="封面 / Cover"), page(src="./pages/results.lay", id="results", name="结果 / Results"), page(src="./pages/summary.lay", id="summary", name="总结 / Summary"),] # Move entries in the list to reorder the document.for p in pages { doc.add(p)}Concepts and common errors · Composition source
transition#
Configure a GL Transitions page transition; texture paths are relative to this declaration.
Returns: A reusable page-transition descriptor for document or page.
Required: name.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Effect name or none | — |
duration |
time | Duration in ms or s | 700ms |
easing |
string | Easing | "ease-in-out" |
params |
dict | Effect parameters in kebab-case | {} |
textures |
dict | Extra texture relative paths | {} |
Minimal complete example#
doc = document( name="GL Transitions · Page turns", transition=transition(name="InvertedPageCurl", duration=700ms, easing="ease-in-out"))doc.add(page(src="pages/start.lay", id="start", name="Start"))doc.add(page(src="pages/curl.lay", id="curl", name="Page curl"))doc.add(page(src="pages/cube.lay", id="cube", name="Cube", transition=transition(name="cube", params={"persp":0.6})))doc.add(page(src="pages/mask.lay", id="mask", name="Texture reveal", transition=transition(name="luma", textures={"luma":"assets/mask.png"})))Concepts and common errors · Composition source
document.add#
Append a page reference with a unique ID. Configure transitions with document/page transition parameters.
Returns: Append a page reference with a unique ID. Configure transitions with document/page transition parameters.
Positional parameters: page.
Required: page.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
page |
page | Independent page reference | — |
Minimal complete example#
# Each page remains an ordinary, independently renderable .lay file.doc = document(name="LayMesh multi-page report")pages = [ page(src="./pages/cover.lay", id="cover", name="封面 / Cover"), page(src="./pages/results.lay", id="results", name="结果 / Results"), page(src="./pages/summary.lay", id="summary", name="总结 / Summary"),] # Move entries in the list to reorder the document.for p in pages { doc.add(p)}Concepts and common errors · Composition source
canvas#
Create a page with physical dimensions, a background and a default geometry unit. Place material with add. Unitless geometry initially uses mm; font sizes and line widths use pt.
Returns: A page that accepts placed material.
Required: size.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Canvas title or unique named-axis identifier | "Untitled" |
size |
(length, length) / canvas unit | Page (width,height); both lengths must be positive; auto is unsupported | — |
unit |
"mm" | "cm" | "in" | "inch" | "pt" | "px" | Default unit for bare geometry lengths; excludes data and typographymm: Millimeterscm: Centimetersin: Inchesinch: Inchespt: Points, 1/72 inchpx: Layout pixels converted using layout_dpi |
mm |
layout_dpi |
number | Conversion between px and physical lengths; independent of export DPI | 96 |
stylesheet |
string | string[] | .lcss path or ordered list of paths | — |
class |
string | Space-separated LCSS class names | "" |
background |
paint | Background paint for the object region, separate from text or lines | none |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex (inherit) |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
Minimal complete example#
# Minimal complete example: canvaspage=canvas(size=(100mm,75mm),background="#ffffff")page.add(text("Physical page",font_size=12pt),offset=(5mm,5mm))Concepts and common errors · Composition source
image#
Define reusable image material from a local file. add controls size, crop and contain/cover/stretch fitting; paths resolve relative to the defining file. Accepts PNG, JPEG, BMP, WebP, GIF, ICO, PNM, TGA, safe SVG, and single-page unsigned 8/16-bit grayscale/RGB TIFF with optional alpha. GIF and animated WebP use the first frame; 16-bit intensities are not stretched.
Returns: material
Positional parameters: src.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
class |
string | Space-separated LCSS class names | "" |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: imagepage=canvas(size=(100mm,75mm),background="#ffffff")page.add(image(src="../assets/photo.png"),size=(55mm,auto),offset=(8mm,8mm))Concepts and common errors · Composition source
text#
Create text material, recognizing inline mathematics in ordinary strings. Configure font fallback, size, color and a background box. size can constrain wrapping; raw strings disable automatic mathematics.
Returns: Reusable text material.
Positional parameters: content.
Required: content / spans.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
content |
string | Text content; $…$ enables math, raw strings disable automatic math | — |
spans |
(span | formula)[] | Ordered span(...) and formula(...) items | — |
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
class |
string | Space-separated LCSS class names | "" |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex (inherit) |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 10pt |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
align |
"left" | "center" | "right" | "justify" | Horizontal text alignment in its frameleft: Left side or left alignment, according to the parametercenter: Center alignmentright: Right side or right alignment, according to the parameterjustify: Justify within the available width |
left |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
text_fill |
paint | 字形填充 / Glyph paint; defaults to color | — |
text_stroke_color |
color | 字形描边颜色 / Glyph stroke color | none |
text_stroke_width |
length / pt | 字形描边宽度 / Glyph stroke width | 0 |
path |
text_path | 沿路径排字 / Text path configuration | — |
warp |
text_warp | 字形变形 / Text warp configuration | — |
extrude |
text_extrude | 二维矢量挤出 / Vector extrusion | — |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: textpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(text("Wrapping preserves physical type size.",size=(45mm,auto),font_size=12pt),offset=(8mm,8mm))Concepts and common errors · Composition source
span#
Define a run inside text(spans=[...]) with local font/color overrides. A span is not independently placed material.
Returns: value
Positional parameters: content.
Required: content.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
content |
string | Text content; $…$ enables math, raw strings disable automatic math | — |
class |
string | Space-separated LCSS class names | "" |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex (inherit) |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
text_fill |
paint | 字形填充 / Glyph paint; defaults to color | — |
text_stroke_color |
color | 字形描边颜色 / Glyph stroke color | none |
text_stroke_width |
length / pt | 字形描边宽度 / Glyph stroke width | 0 |
Minimal complete example#
# Minimal complete example: spanpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(text(spans=[span("Red ",color="#e36b70"),span("bold",font_weight=700)],font_size=12pt),offset=(8mm,8mm))Concepts and common errors · Composition source
formula#
Create formula material from LaTeX without dollar delimiters, or a run in text. Raw strings preserve backslashes; style selects inline/display layout.
Returns: material
Positional parameters: source.
Required: source.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
source |
string | LaTeX formula source without dollar delimiters | — |
class |
string | Space-separated LCSS class names | "" |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 10pt (inherit in text) |
color |
color | Text color or base series color | #000000 |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
style |
"inline" | "display" | Style object for plots; inline/display for explicit formulasinline: Inline mathematical layoutdisplay: Display mathematical layout |
— |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
font_family |
string | string[] | Font family, path or ordered fallback list for formula text; math_font controls mathematical symbols. | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 继承 / inherit |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
继承 / inherit |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: formulapage=canvas(size=(100mm,75mm),background="#ffffff")page.add(formula(r"E=mc^2",style=display,font_size=16pt,math_font=ratex_katex),offset=(8mm,8mm))Concepts and common errors · Composition source
rect#
Create a rectangle material. Set physical dimensions with size, interior paint with fill, the outline with border_*, and rounded corners with border_radius. Place it on the page with add.
Returns: Reusable rectangle material.
Required: size.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | 0.3mm (if border_color is set) |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: rectpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(40mm,25mm),border_radius=7mm,fill="#e6f2f3",border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
ellipse#
Define ellipse material with size=(width,height). fill and border_* control interior and outline; layout corners need not lie on the ellipse.
Returns: material
Required: size.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | 0.3mm (if border_color is set) |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: ellipsepage=canvas(size=(100mm,75mm),background="#ffffff")page.add(ellipse(size=(45mm,25mm),fill="#e6f2f3",border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
line#
Create reusable line material. Omit geometry and supply start/end in add, or define dx/dy or length/angle. Placement requires geometry; zero length requires an explicit angle. Supports independent caps and heads.
Returns: material
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
length |
length / canvas unit | Nonnegative line length; mutually exclusive with dx/dy | — |
angle |
angle / deg | Local direction: 0 right, 90 down; required explicitly for zero length | 0deg |
dx |
length / canvas unit | Horizontal line displacement; requires dy, exclusive with length/angle | — |
dy |
length / canvas unit | Vertical line displacement; requires dx, exclusive with length/angle | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | #000000 |
line_width |
length / pt | Open-line width; unitless values are pt | 0.3pt |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
start_head |
head | Start head configuration; absent by default | — |
end_head |
head | End head configuration; absent by default | — |
start_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
end_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: linepage=canvas(size=(100mm,75mm),background="#ffffff")page.add(line(length=55mm,angle=20deg,start_cap=round,end_head=head(shape=triangle,size=(6mm,5mm)),line_width=2mm),offset=(12mm,15mm))# Geometry-free material: its endpoints are supplied when placed.wire=line(line_color="#087f8c",end_head=head(shape=open))a=page.add(rect(size=(18mm,10mm),fill="#e0f1ef"),offset=(10mm,50mm))b=page.add(rect(size=(18mm,10mm),fill="#e0f1ef"),offset=(70mm,55mm))page.add(wire,start=a.middle_right,end=b.middle_left,start_offset=(2mm,0mm),end_offset=(-2mm,0mm))Concepts and common errors · Composition source
group#
Create a reusable container with local coordinates. Populate it before placement; first placement seals contents and reuse replays internal positioning dependencies.
Returns: material
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
class |
string | Space-separated LCSS class names | "" |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
Minimal complete example#
# Minimal complete example: grouppage=canvas(size=(100mm,75mm),background="#ffffff")g=group()a=g.add(rect(size=(35mm,20mm),fill="#e6f2f3"))g.add(text("Reused"),target=a.center,anchor=center)page.add(g,offset=(8mm,8mm))page.add(g,offset=(55mm,38mm),rotation=15deg)Concepts and common errors · Composition source
path#
Define a path from original move_to/line_to/quad_to/cubic_to/arc_to/close commands. It may contain multiple subpaths; open subpaths support caps and heads.
Returns: material
Required: commands.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
commands |
path-command[] | Ordered path commands starting with move_to | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
start_head |
head | Start head configuration; absent by default | — |
end_head |
head | End head configuration; absent by default | — |
start_cap |
"butt" | "round" | "square" | Independent path endpoint cap, inheriting border_cap; internal dash caps are unaffectedbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits border_cap |
end_cap |
"butt" | "round" | "square" | Independent path endpoint cap, inheriting border_cap; internal dash caps are unaffectedbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits border_cap |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: pathpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,20mm),quad_to(20mm,0mm,40mm,20mm),line_to(40mm,35mm),close()],fill="#e6f2f3",border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
polygon#
Define an automatically closed polygon from at least three points. Node order determines traversal; fill_rule controls self-intersecting fills.
Returns: material
Required: points.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
points |
value | Point list; star uses an integer corner count, violin uses a KDE sample count | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: polygonpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(polygon(points=[(0mm,0mm),(40mm,0mm),(30mm,30mm)],fill="#e6f2f3"),offset=(10mm,10mm))Concepts and common errors · Composition source
polyline#
Define an open polyline from at least two points. line_* controls stroke, start_head/end_head locate at logical endpoints, and line_join controls corners.
Returns: material
Required: points.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
points |
value | Point list; star uses an integer corner count, violin uses a KDE sample count | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
start_head |
head | Start head configuration; absent by default | — |
end_head |
head | End head configuration; absent by default | — |
start_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
end_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: polylinepage=canvas(size=(100mm,75mm),background="#ffffff")page.add(polyline(points=[(0mm,20mm),(20mm,0mm),(45mm,20mm)],line_color="#087f8c",line_width=1.5mm,line_join=round),offset=(10mm,10mm))Concepts and common errors · Composition source
arc#
Define an open circular arc with radius/start/end. Page angles point right at 0 and down at 90; caps and heads are supported without closing to a sector.
Returns: material
Required: radius, start, end.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
radius |
length / canvas unit | Geometric radius; normalized scalar for radial_gradient | — |
start |
value | Arc start angle; normalized start point for linear gradients | — |
end |
value | Arc end angle; normalized end point for linear gradients | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
start_head |
head | Start head configuration; absent by default | — |
end_head |
head | End head configuration; absent by default | — |
start_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
end_cap |
"butt" | "round" | "square" | Independent endpoint cap; inherits line_capbutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
inherits line_cap |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: arcpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(arc(radius=20mm,start=0deg,end=120deg,line_width=1mm,end_head=head(shape=open)),offset=(15mm,15mm))Concepts and common errors · Composition source
sector#
Define a closed sector by radius and endpoint angles. Fill covers the region between center and arc; border_* controls the outline.
Returns: material
Required: radius, start, end.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
radius |
length / canvas unit | Geometric radius; normalized scalar for radial_gradient | — |
start |
value | Arc start angle; normalized start point for linear gradients | — |
end |
value | Arc end angle; normalized end point for linear gradients | — |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: sectorpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(sector(radius=20mm,start=0deg,end=120deg,fill="#087f8c"),offset=(15mm,15mm))Concepts and common errors · Composition source
star#
Define a closed star with point count, outer/inner radii and rotation. inner_radius must be smaller than outer_radius.
Returns: material
Required: points, outer_radius, inner_radius.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
points |
value | Point list; star uses an integer corner count, violin uses a KDE sample count | — |
outer_radius |
length / canvas unit | Outer geometric radius | — |
inner_radius |
length / canvas unit | Inner geometric radius; physical hole radius for polar plots | 0 |
rotation |
value | Rotation about the instance center | 0deg |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: starpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(star(points=5,outer_radius=20mm,inner_radius=9mm,fill="#e6f2f3",border_color="#087f8c"),offset=(15mm,15mm))Concepts and common errors · Composition source
ring#
Define a ring with a transparent inner hole. inner_radius is smaller than outer_radius; the hole reveals underlying paint rather than covering it with background.
Returns: material
Required: outer_radius, inner_radius.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
outer_radius |
length / canvas unit | Outer geometric radius | — |
inner_radius |
length / canvas unit | Inner geometric radius; physical hole radius for polar plots | 0 |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: ringpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(ring(outer_radius=20mm,inner_radius=13mm,fill="#087f8c"),offset=(15mm,15mm))Concepts and common errors · Composition source
box#
Create a rectangular region configuration for plot_area or crop. box draws nothing by itself; units depend on use, with crop using normalized 0–1 coordinates.
Returns: box
Required: size.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
offset |
(length, length) / canvas unit | Horizontal and vertical offset from the target | (0, 0) |
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
Minimal complete example#
# Minimal complete example: boxpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(image(src="../assets/photo.png"),size=(60mm,auto),crop=box(offset=(0.25,0),size=(0.75,1)),offset=(10mm,10mm))Concepts and common errors · Composition source
instance.data#
Select an original-data point on a placed chart. Axis transforms, breaks, instance transforms and group replay resolve the reference again; the point must be in a valid visible domain.
Returns: anchor
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
category |
value | Radar category name | — |
value |
value | Input scalar, string or list element | — |
Minimal complete example#
# Minimal complete example: instance.datapage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.scatter(x=[1,2,3],y=[1,3,2])chart=page.add(p,offset=(7mm,6mm))page.add(text("Peak"),target=chart.data(x=2,y=3),anchor=bottom_center,offset=(0mm,-2mm))Concepts and common errors · Composition source
instance.axis#
Select a named chart axis at its numeric start, physical midpoint or numeric end. Legacy transforms are retained; axes[name].spine.path provides explicit spine queries.
Returns: anchor
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Canvas title or unique named-axis identifier | — |
anchor |
"start" | "center" | "end" | Anchor on this instance used for alignmentstart: Start of the axis spinecenter: Midpoint of the axis spineend: End of the axis spine |
top_left |
Minimal complete example#
# Minimal complete example: instance.axispage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.line(x=[0,1,2,3],y=[1,2,4,3])chart=page.add(p,offset=(7mm,6mm))page.add(ellipse(size=(2mm,2mm),fill="#e36b70"),anchor=center,target=chart.axis(name="x",anchor=center))Concepts and common errors · Composition source
add#
Place material in a canvas or group using anchor/target, or connect two start/end points with line or filled-arrow material. Offset translates the entire instance. Reuse material with independent style overrides.
Returns: A placed instance with measured dimensions and anchors for subsequent placement.
Positional parameters: material.
Required: material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
fit |
"contain" | "cover" | "stretch" | contain preserves the whole image; cover crops; stretch distortscontain: Preserve aspect ratio and the complete content; unused space may remaincover: Preserve aspect ratio and fill the container; crop overflowstretch: Scale width and height independently to fill the target size |
contain |
crop |
box (normalized 0–1) | Normalized crop region in the source image; coordinates are 0–1 | — |
anchor |
"top_left" | "top_center" | "top_right" | "middle_left" | "center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right" | "start" | "end" | "plot_top_left" | "plot_top_center" | "plot_top_right" | "plot_middle_left" | "plot_center" | "plot_middle_right" | "plot_bottom_left" | "plot_bottom_center" | "plot_bottom_right" | self selector | Source bounds name, line start/end, plot-only plot_* name, or a self geometry selector; targets belong to placed instances in the same containertop_left: Top-left corner of the layout boxtop_center: Top-edge midpoint of the layout boxtop_right: Top-right corner of the layout boxmiddle_left: Left-edge midpoint of the layout boxcenter: Center of the layout boxmiddle_right: Right-edge midpoint of the layout boxbottom_left: Bottom-left corner of the layout boxbottom_center: Bottom-edge midpoint of the layout boxbottom_right: Bottom-right corner of the layout boxstart: Legacy start anchor for endpoint-bearing materials; retains legacy transform semanticsend: Legacy end anchor for endpoint-bearing materials; retains legacy transform semanticsplot_top_left: Plot-area box anchor; plot material only, transformed with the instanceplot_top_center: Plot-area box anchor; plot material only, transformed with the instanceplot_top_right: Plot-area box anchor; plot material only, transformed with the instanceplot_middle_left: Plot-area box anchor; plot material only, transformed with the instanceplot_center: Plot-area box anchor; plot material only, transformed with the instanceplot_middle_right: Plot-area box anchor; plot material only, transformed with the instanceplot_bottom_left: Plot-area box anchor; plot material only, transformed with the instanceplot_bottom_center: Plot-area box anchor; plot material only, transformed with the instanceplot_bottom_right: Plot-area box anchor; plot material only, transformed with the instance |
top_left |
target |
anchor | Anchor on an instance in the same container; candidate collections require explicit indexing | parent.top_left |
offset |
(length, length) / canvas unit | Horizontal and vertical offset from the target; translates both endpoints in a line connection | (0, 0) |
rotation |
angle | Rotate about the instance center; accepts a path anchor tangent_angle | 0deg |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
class |
string | Space-separated LCSS class names | "" |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
offset_space |
"container" | "target" | Offset in container coordinates, or target tangent and left normal.; line connections accept container only, with separate start_offset_space/end_offset_space for endpoint framescontainer: Offsets follow the current container axestarget: Offsets follow the target tangent and left normal |
container |
start |
anchor | (length, length) | Coordinate or anchor for a line/arrow endpoint connection | — |
end |
anchor | (length, length) | Coordinate or anchor for a line/arrow endpoint connection | — |
start_offset |
(length, length) / canvas unit | Independent physical offset of the start, followed by the overall offset | (0, 0) |
end_offset |
(length, length) / canvas unit | Independent physical offset of the end, followed by the overall offset | (0, 0) |
start_offset_space |
"container" | "target" | Direction frame for the start offset; target requires a path anchor with an unambiguous tangentcontainer: Along the current container axestarget: Along this path anchor tangent and left normal |
container |
end_offset_space |
"container" | "target" | Direction frame for the end offset; target requires a path anchor with an unambiguous tangentcontainer: Along the current container axestarget: Along this path anchor tangent and left normal |
container |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
# Minimal complete example: addpage=canvas(size=(100mm,75mm),background="#ffffff")material=rect(size=(25mm,18mm),fill="#087f8c")a=page.add(material,offset=(10mm,10mm))page.add(material,anchor=top_left,target=a.bottom_right,offset=(3mm,3mm))Concepts and common errors · Composition source
fuse#
Fuse visible outlines of two placed vector instances in one container; inputs leave drawing and references. Connecting a gap requires positive bridge_width; images/text/groups are unsupported.
Returns: instance
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
points |
value | Point list; star uses an integer corner count, violin uses a KDE sample count | — |
bridge_width |
length / canvas unit | Physical fusion bridge width | — |
junction |
value | Fusion junction mode | — |
radius |
length / canvas unit | Geometric radius; normalized scalar for radial_gradient | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
fill_rule |
value | Interior winding rule: nonzero/evenodd | nonzero |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: fusepage=canvas(size=(100mm,75mm),background="#ffffff")a=page.add(rect(size=(25mm,20mm),fill="#087f8c"),offset=(10mm,10mm))b=page.add(rect(size=(25mm,20mm),fill="#087f8c"),offset=(30mm,10mm))page.fuse(a,b,fill="#087f8c")Concepts and common errors · Composition source
linear_gradient#
Create linear-gradient paint with stops in 0–1 and start/end normalized to material bounds. Color alpha multiplies stop opacity.
Returns: paint
Required: stops.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
start |
value / scalar | Arc start angle; normalized start point for linear gradients | — |
end |
value / scalar | Arc end angle; normalized end point for linear gradients | — |
stops |
(number, color, number?)[] / scalar | At least two ordered (position 0–1, color[, opacity]) stops | — |
Minimal complete example#
# Minimal complete example: linear_gradientpage=canvas(size=(100mm,75mm),background="#ffffff")paint=linear_gradient(stops=[(0,"#0072b2"),(1,"#ffffff90")])page.add(rect(size=(60mm,30mm),fill=paint),offset=(10mm,10mm))Concepts and common errors · Composition source
radial_gradient#
Create radial-gradient paint with center/radius relative to bounds. Reuse the paint across different shapes; placement dimensions determine final rendering.
Returns: paint
Required: stops.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
center |
value / scalar | Gradient center coordinates or data center of color normalization | — |
radius |
value / scalar | Geometric radius; normalized scalar for radial_gradient | — |
stops |
(number, color, number?)[] / scalar | At least two ordered (position 0–1, color[, opacity]) stops | — |
Minimal complete example#
# Minimal complete example: radial_gradientpage=canvas(size=(100mm,75mm),background="#ffffff")paint=radial_gradient(stops=[(0,"#ffffff"),(1,"#087f8c")])page.add(ellipse(size=(60mm,35mm),fill=paint),offset=(10mm,10mm))Concepts and common errors · Composition source
conic_gradient#
Create a conic-gradient paint
Returns: paint
Positional parameters: stops.
Required: stops.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
stops |
(number, color, number?)[] / scalar | At least two ordered stops; 0–1 spans one turn | — |
center |
value / scalar | Normalized center, including outside the bounds | [0.5, 0.5] |
angle |
angle / deg | Starting angle clockwise from the top | 0 |
Minimal complete example#
page=canvas(size=(100mm,75mm),background="#ffffff")paint=conic_gradient(stops=[(0,"#f97316"),(0.5,"#2563eb"),(1,"#f97316")],center=(0.5,0.5),angle=0deg)page.add(ellipse(size=(60mm,50mm),fill=paint,border_width=0),offset=(20mm,12mm))Concepts and common errors · Composition source
gradient#
Create paint from CSS gradient syntax, including repetition and color interpolation
Returns: paint
Required: css.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
css |
string | One CSS gradient function | — |
Minimal complete example#
page=canvas(size=(100mm,75mm),background="#ffffff")paint=gradient(css="repeating-linear-gradient(35deg in oklab, #f97316 0mm 4mm, #2563eb 4mm 8mm)")page.add(rect(size=(80mm,50mm),fill=paint,border_width=0),offset=(10mm,12mm))Concepts and common errors · Composition source
hatch#
Create slash/cross/dots pattern paint. spacing and line_width are physical dimensions; the pattern is confined to the material fill region.
Returns: paint
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
pattern |
"slash" | "cross" | "dots" | Repeating pattern: slash/cross/dotsslash: Diagonal hatch patterncross: Cross hatch patterndots: Dot hatch pattern |
slash |
color |
color | Text color or base series color | — |
background |
paint | Background paint for the object region, separate from text or lines | none |
spacing |
length / canvas unit | Physical pattern spacing | 2mm |
line_width |
length / pt | Open-line width; unitless values are pt | — |
angle |
angle | Pattern rotation angle | 0deg |
Minimal complete example#
# Minimal complete example: hatchpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(60mm,30mm),fill=hatch(pattern=cross,color="#087f8c",spacing=3mm,line_width=0.5pt)),offset=(10mm,10mm))Concepts and common errors · Composition source
image_fill#
Use a local image as paint inside a shape, with fit controlling adaptation. Unlike image material, paint is confined to the shape outline, including rounded rectangles.
Returns: paint
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
fit |
"contain" | "cover" | "stretch" | contain preserves the whole image; cover crops; stretch distortscontain: Preserve aspect ratio and the complete content; unused space may remaincover: Preserve aspect ratio and fill the container; crop overflowstretch: Scale width and height independently to fill the target size |
contain |
Minimal complete example#
# Minimal complete example: image_fillpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(60mm,35mm),fill=image_fill(src="../assets/photo.png",fit=cover),border_radius=8mm),offset=(10mm,10mm))Concepts and common errors · Composition source
table#
Read CSV or column-oriented JSON with unique nonempty headers and equal column lengths. d["column"] selects a column; null and empty CSV cells retain missing values.
Returns: table
Positional parameters: src.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
Minimal complete example#
# Minimal complete example: tablepage=canvas(size=(100mm,75mm),background="#ffffff")d=table(src="../plot/first-plot.csv")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.line(x=d["time"],y=d["signal"])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
array#
Read a nonempty numeric vector/matrix from JSON. Matrices must be rectangular; null is missing. Inline data uses lists rather than array(values=...).
Returns: number[] | number[][]
Positional parameters: src.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
Minimal complete example#
# Minimal complete example: arraypage=canvas(size=(100mm,75mm),background="#ffffff")x=array(src="observations.json")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.scatter(x=x,y=[1,2,4,3],marker=circle)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot#
Create a native plot with physical dimensions and add data through layer methods. Configure axes with x and y, or fix the drawing area with plot_area. Place the plot on the page with add.
Returns: A plot accepting data layers and page placement.
Required: size.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
style |
plot_style | plot_style(...) configuration; supplies defaults not overridden by explicit parameters | — |
margins |
(length, length, length, length) / canvas unit | Plot margins (left,top,right,bottom); exclusive with plot_area | — |
plot_area |
box / canvas unit | Fixed physical plot area: box(offset=(left,top), size=(width,height)) | — |
frame |
"axes" | "box" | "none" | boolean | axes/box/none for plot frames; boolean for legend framesaxes: Draw enabled axis spines onlybox: Draw the complete rectangular plot framenone: Do not draw this item |
axes |
projection |
"cartesian" | "polar" | "radar" | Cartesian, polar, or radar projectioncartesian: Cartesian horizontal and vertical coordinatespolar: Angular and radial coordinatesradar: Radar coordinates arranged by category |
cartesian |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
angle_unit |
"deg" | "rad" | Unit of polar angular datadeg: Angles are expressed in degreesrad: Angles are expressed in radians |
deg |
theta_zero |
value | Zero-angle direction: east/north/west/south | east |
theta_direction |
value | Increasing-angle direction: ccw/cw | ccw |
r_label_angle |
value | Angle for radial tick labels | — |
inner_radius |
length / canvas unit | Inner geometric radius; physical hole radius for polar plots | 0 |
categories |
string[] | Ordered radar category names | — |
category_labels |
(string | text | formula)[] | Displayed radar category labels, including math | — |
ranges |
(number, number)[] | Independent data domain of each radar category | — |
radar_frame |
value | Radar frame shape: polygon/circle | polygon |
class |
string | Space-separated LCSS class names | "" |
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex (inherit) |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
Minimal complete example#
# Minimal complete example: plotpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.line(x=[0,1,2,3],y=[1,2,4,3],label="Signal")page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
axis#
Configure data domain, linear/log/symlog mapping, ticks, labels and breaks. Domains use original values; text/stroke dimensions are physical.
Returns: axis
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | — |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
notation |
"plain" | "scientific" | "offset" | plain/scientific/offset number display without changing dataplain: Show tick numbers directlyscientific: Use scientific notation for ticksoffset: Show ticks with a shared offset |
plain |
format |
value | D3 numeric format, such as .2f or .2e | — |
exponent |
value | Integer decimal exponent for offset notation | — |
exponent_offset |
length / canvas unit | Physical offset of the multiplier from its default position | (0,0) |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
label_offset |
length / canvas unit | Physical offset of an axis or colorbar title | (0,0) |
scale |
"linear" | "log" | "symlog" | linear/log/symlog axis transform, or shared color-scale objectlinear: Linear mappinglog: Logarithmic mapping; values must be positivesymlog: Linear near zero and logarithmic farther away |
linear |
range |
(number, number) | Explicit axis data domain (minimum, maximum) | — |
ticks |
number[] | Increasing, unique major tick data values | — |
minor_ticks |
number[] | auto | Minor tick values, or auto | — |
tick_direction |
"in" | "out" | "inout" | Tick direction: in, out, or bothin: Ticks point into the plot areaout: Ticks point out of the plot areainout: Ticks extend in both directions |
out |
tick_length |
length / canvas unit | Physical major tick length | 1.2mm |
minor_tick_length |
length / canvas unit | Physical minor tick length | 0.6mm |
tick_labels |
boolean | Whether tick labels are shown | true |
tick_rotation |
value | Tick-label rotation angle | 0deg |
tick_offset |
length / canvas unit | Physical tick-label displacement | (0,0) |
tick_font_size |
length / pt | Tick-label font size; unitless values are pt | 继承字号 / inherit font_size |
tick_color |
color | Tick and tick-label color | — |
grid |
"none" | "major" | "both" | Major grid, all grid lines, or nonenone: No gridmajor: Major tick grid onlyboth: Major and minor tick grids |
none |
reverse |
boolean | Reverse the axis mapping | false |
constant |
value | Positive threshold for the linear region of symlog | 1 |
breaks |
value | Ordered intervals excluded from the axis domain | — |
break_gap |
length / canvas unit | Physical gap size; one value or one per gap | 2mm |
segment_lengths |
value | Fixed physical length of each visible axis segment | — |
spine |
boolean | Whether to draw the axis spine | true |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
tick_text |
(string | text | formula)[] | Text or math labels, one per explicit tick | — |
break_mark_size |
value | Physical size of diagonal break marks | — |
Minimal complete example#
# Minimal complete example: axispage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4),ticks=[0,2,4],label="Time"),y=axis(range=(0,5),grid=major))p.line(x=[0,1,2,3],y=[1,2,4,3])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot_style#
Define shared chart/layer/decoration style defaults. Explicit call parameters win; this is not an inline/display string option.
Returns: plot_style
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
font_family |
string | string[] | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. | system sans-serif |
math_font |
string | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. | ratex-katex (inherit) |
math_text_fallback |
boolean | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. | true (inherit) |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 8pt |
font_weight |
integer | Font weight, 100–900 | 400 |
font_style |
"normal" | "italic" | Normal or italicnormal: Upright font styleitalic: Italic font style |
normal |
color |
color | Text color or base series color | #222222 |
line_height |
length / pt | Text line height; unitless values are pt | 1.2 × font_size |
tick_font_size |
length / pt | Tick-label font size; unitless values are pt | 继承字号 / inherit font_size |
label_font_size |
length / pt | Axis-label font size; unitless values are pt | 继承字号 / inherit font_size |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | 0.6pt |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
colors |
color[] | Nonempty color cycle, conveniently generated with palette(...) | — |
grid_color |
color | Grid-line color | #dddddd |
grid_line_width |
length / pt | Grid-line width; unitless values are pt | 0.3pt |
grid_line_dash |
value | Grid dash pattern; unitless values are pt | [] |
Minimal complete example#
# Minimal complete example: plot_stylepage=canvas(size=(100mm,75mm),background="#ffffff")s=plot_style(font_size=9pt,line_width=1pt)p=plot(size=(86mm,62mm),style=s)p.line(x=[0,1,2,3],y=[1,2,4,3])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
color_scale#
Define a shared numeric color mapping. Continuous norms use explicit bounds; boundary uses interval edges. Layers and standalone colorbars reference the same configuration.
Returns: color_scale
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
norm |
"linear" | "log" | "symlog" | "centered" | "boundary" | Color normalization: linear/log/symlog/centered/boundarylinear: Linear mappinglog: Logarithmic mapping; values must be positivesymlog: Linear near zero and logarithmic farther awaycentered: Continuous color normalization split at centerboundary: Discrete color normalization by boundaries |
linear |
vmin |
value | Minimum data value of the color mapping | — |
vmax |
value | Maximum data value of the color mapping | — |
center |
value | Gradient center coordinates or data center of color normalization | — |
cmap |
string | color[] | cmap | Preset name, custom color list or cmap(...) handle | viridis |
constant |
value | Positive threshold for the linear region of symlog | 1 |
boundaries |
value | Ordered boundaries for discrete color normalization | — |
under |
value | Color below the scale minimum | — |
over |
value | Color above the scale maximum | — |
Minimal complete example#
# Minimal complete example: color_scalepage=canvas(size=(100mm,75mm),background="#ffffff")s=color_scale(norm=linear,vmin=0,vmax=5,cmap=["#ffffff90","#087f8c"])p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.scatter(x=[0,1,2,3],y=[1,2,4,3],c=[0,2,4,5],color_scale=s)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
legend#
Create independently placed legend material from existing layers. label supplies text and layer style supplies samples; add positions it on a page or group.
Returns: material
Required: layers.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
layers |
plot-layer[] | Existing layers represented by a shared legend | — |
style |
plot_style | plot_style(...) defaults; explicit parameters win | — |
position |
"top_left" | "top_center" | "top_right" | "middle_left" | "center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right" | (length,length) | Legend placement, statistical group position, or colorbar placement, depending on the ownertop_left: Top-left corner of the layout boxtop_center: Top-edge midpoint of the layout boxtop_right: Top-right corner of the layout boxmiddle_left: Left-edge midpoint of the layout boxcenter: Center alignmentmiddle_right: Right-edge midpoint of the layout boxbottom_left: Bottom-left corner of the layout boxbottom_center: Bottom-edge midpoint of the layout boxbottom_right: Bottom-right corner of the layout box |
top_right |
columns |
integer | Positive integer column count; row-major order | 1 |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
background |
paint | Background paint for the object region, separate from text or lines | #ffffff |
frame |
enum | boolean | axes/box/none for plot frames; boolean for legend frames | false |
title |
string | text | formula | Legend title with text or mathematics | — |
sample_width |
length / canvas unit | Physical legend-sample width | 6mm |
gap |
length / canvas unit | Physical legend-item or colorbar-to-plot gap | — |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 1.2mm |
sample_gap |
length / canvas unit | Physical gap between a legend sample and its label | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: legendpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))layer=p.line(x=[0,1,2,3],y=[1,2,4,3],label="Signal")page.add(p,offset=(7mm,6mm))page.add(legend(layers=[layer]),offset=(10mm,5mm))Concepts and common errors · Composition source
colorbar#
Create standalone colorbar material from color_scale. length/thickness are physical and ticks share the numeric mapping; use add for placement.
Returns: material
Required: scale.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
scale |
"linear" | "log" | "symlog" | linear/log/symlog axis transform, or shared color-scale objectlinear: Linear mappinglog: Logarithmic mapping; values must be positivesymlog: Linear near zero and logarithmic farther away |
— |
style |
plot_style | plot_style(...) defaults; explicit parameters win | — |
notation |
"plain" | "scientific" | "offset" | plain/scientific/offset number display without changing dataplain: Show tick numbers directlyscientific: Use scientific notation for ticksoffset: Show ticks with a shared offset |
plain |
format |
value | D3 numeric format, such as .2f or .2e | — |
exponent |
value | Integer decimal exponent for offset notation | — |
exponent_offset |
length / canvas unit | Physical offset of the multiplier from its default position | (0,0) |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
label_offset |
length / canvas unit | Physical offset of an axis or colorbar title | (0,0) |
position |
"left" | "right" | "top" | "bottom" | (length,length) | Legend placement, statistical group position, or colorbar placement, depending on the ownerleft: Left side or left alignment, according to the parameterright: Right side or right alignment, according to the parametertop: Top sidebottom: Bottom side |
— |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
length |
length / canvas unit | Physical colorbar length | — |
thickness |
length / canvas unit | Physical colorbar thickness | 3mm |
gap |
length / canvas unit | Physical legend-item or colorbar-to-plot gap | — |
ticks |
number[] | Increasing, unique major tick data values | — |
class |
string | Space-separated LCSS class names | "" |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: colorbarpage=canvas(size=(100mm,75mm),background="#ffffff")s=color_scale(vmin=0,vmax=5,cmap="viridis")page.add(colorbar(scale=s,length=45mm,label="Value"),offset=(20mm,12mm))Concepts and common errors · Composition source
plot.add_axis#
Add a uniquely named axis to an unplaced chart. side chooses direction/location, layers select it with x_axis/y_axis, and same-side spacing needs explicit offset.
Returns: axis
Required: name, side, axis.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Canvas title or unique named-axis identifier | — |
side |
"left" | "right" | "top" | "bottom" | Named-axis side: left/right/top/bottomleft: Left side or left alignment, according to the parameterright: Right side or right alignment, according to the parametertop: Top sidebottom: Bottom side |
— |
offset |
(length, length) / canvas unit | Horizontal and vertical offset from the target | (0, 0) |
axis |
value | axis(...) configuration | — |
Minimal complete example#
# Minimal complete example: plot.add_axispage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.add_axis(name="right_y",side=right,axis=axis(range=(0,10),label="Second scale"))p.line(x=[0,1,2,3],y=[1,2,4,3],y_axis="right_y")page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.line#
Add a line layer connecting data points in order, optionally with markers. Choose named axes with x_axis and y_axis; polar plots use theta and r, and radar plots use values.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
marker |
"none" | "circle" | "square" | "triangle" | "triangle_down" | "diamond" | Scatter or line marker shapenone: No markercircle: Circular markersquare: Square markertriangle: Upward triangle markertriangle_down: Downward triangle markerdiamond: Diamond marker |
circle |
marker_size |
length / canvas unit | Physical marker size, including its border | — |
marker_fill |
value | Marker interior color, or none | — |
marker_border_color |
color | Marker border color, or none | none |
marker_border_width |
length / pt | Marker border width; unitless values are pt | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
closed |
boolean | Connect the first and last points | false |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
zero_baseline |
value | Baseline at the visible edge of a logarithmic axis | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
Minimal complete example#
# Minimal complete example: plot.linepage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.line(x=[0,1,2,3],y=[1,2,4,3],marker=circle)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.scatter#
Add a scatter layer. Set marker shape, physical size and border, or map numeric c values to colors through color_scale.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
marker |
"none" | "circle" | "square" | "triangle" | "triangle_down" | "diamond" | Scatter or line marker shapenone: No markercircle: Circular markersquare: Square markertriangle: Upward triangle markertriangle_down: Downward triangle markerdiamond: Diamond marker |
circle |
marker_size |
length / canvas unit | Physical marker size, including its border | — |
marker_fill |
value | Marker interior color, or none | — |
marker_border_color |
color | Marker border color, or none | none |
marker_border_width |
length / pt | Marker border width; unitless values are pt | — |
c |
value | Numeric scatter color data | — |
color_scale |
color | Shared color_scale(...) object | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.scatterpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.scatter(x=[0,1,2,3],y=[1,2,4,3],marker=diamond)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.errorbar#
Add error bars. xerr and yerr accept symmetric errors or separate lower and upper errors; cap_size sets the physical cap length.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
marker |
"none" | "circle" | "square" | "triangle" | "triangle_down" | "diamond" | Scatter or line marker shapenone: No markercircle: Circular markersquare: Square markertriangle: Upward triangle markertriangle_down: Downward triangle markerdiamond: Diamond marker |
circle |
marker_size |
length / canvas unit | Physical marker size, including its border | — |
marker_fill |
value | Marker interior color, or none | — |
marker_border_color |
color | Marker border color, or none | none |
marker_border_width |
length / pt | Marker border width; unitless values are pt | — |
yerr |
number | number[] | (number[], number[]) | Vertical errors: scalar, symmetric array, or lower/upper arrays | — |
xerr |
number | number[] | (number[], number[]) | Horizontal errors: scalar, symmetric array, or lower/upper arrays | — |
cap_size |
length / canvas unit | Physical error-bar cap size | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.errorbarpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.errorbar(x=[1,2,3],y=[1,3,2],yerr=[0.2,0.4,0.3])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.band#
Filled band layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
lower |
value | Lower data boundary of a band | — |
upper |
value | Upper data boundary of a band | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
hatch |
value | Layer hatch selector slash/cross; fill=hatch(...) also supports dots | — |
hatch_spacing |
value | Physical layer-hatch spacing | 1.5mm |
hatch_width |
length / pt | Layer-hatch width; unitless values are pt | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.bandpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.band(x=[0,1,2,3],lower=[0.5,1,2,1],upper=[1.5,3,4,3])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.hline#
Horizontal reference line layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.hlinepage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.hline(y=2)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.vline#
Vertical reference line layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.vlinepage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.vline(x=2)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.bar#
Bar plot layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
data_width |
number / data | Width in data coordinates, independent of physical units | — |
angle_width |
number / angle | Polar bar angular width, using angle_unit | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
hatch |
value | Layer hatch selector slash/cross; fill=hatch(...) also supports dots | — |
hatch_spacing |
value | Physical layer-hatch spacing | 1.5mm |
hatch_width |
length / pt | Layer-hatch width; unitless values are pt | — |
positions |
number[] | Bar centers in data coordinates | — |
values |
number[] | Observed samples for statistics, or bar values | — |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
baseline |
value | Area or bar baseline in data coordinates | 0 |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
width_unit |
value | Angular unit of a polar bar width | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.barpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.bar(positions=[1,2,3],values=[1,4,2],data_width=0.6)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.step#
Step plot layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
where |
"pre" | "mid" | "post" | Step-change position: pre/mid/postpre: Extend steps on the leftmid: Change value at interval midpointspost: Extend steps on the right |
post |
fill |
paint | Interior color, gradient, pattern or image paint | none |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.steppage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.step(x=[0,1,2,3],y=[1,2,4,3],where=post)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.area#
Area plot layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
baseline |
value | Area or bar baseline in data coordinates | 0 |
fill |
paint | Interior color, gradient, pattern or image paint | none |
hatch |
value | Layer hatch selector slash/cross; fill=hatch(...) also supports dots | — |
hatch_spacing |
value | Physical layer-hatch spacing | 1.5mm |
hatch_width |
length / pt | Layer-hatch width; unitless values are pt | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.areapage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.area(x=[0,1,2,3],y=[1,2,4,3])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.hist#
Histogram layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
values |
number[] | Observed samples for statistics, or bar values | — |
bins |
integer | number[] | Positive histogram bin count or increasing edges | — |
weights |
value | Nonnegative weight of each observation | — |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
fill |
paint | Interior color, gradient, pattern or image paint | none |
hatch |
value | Layer hatch selector slash/cross; fill=hatch(...) also supports dots | — |
hatch_spacing |
value | Physical layer-hatch spacing | 1.5mm |
hatch_width |
length / pt | Layer-hatch width; unitless values are pt | — |
stat |
"count" | "probability" | "density" | Histogram statistic: count/probability/densitycount: Sample count in each binprobability: Probability per bin; all bins sum to onedensity: Probability density normalized by bin width |
count |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.histpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.hist(values=[0.2,0.8,1.1,1.2,2.4,3.1],bins=[0,1,2,3,4])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.boxplot#
Box plot layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
values |
number[] | Observed samples for statistics, or bar values | — |
position |
value | Legend placement, statistical group position, or colorbar placement, depending on the owner | — |
data_width |
number / data | Width in data coordinates, independent of physical units | — |
outlier_size |
length / canvas unit | Physical outlier size | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
whisker |
value | Boxplot whisker length in interquartile ranges | 1.5 |
outliers |
boolean | Whether to show boxplot outliers | true |
median_color |
color | Median-line color | — |
median_line_width |
length / pt | Median-line width; unitless values are pt | — |
whisker_color |
color | Whisker color | — |
whisker_line_width |
length / pt | Whisker width; unitless values are pt | — |
outlier_marker |
"none" | "circle" | "square" | "triangle" | "triangle_down" | "diamond" | Outlier marker shapenone: No markercircle: Circular markersquare: Square markertriangle: Upward triangle markertriangle_down: Downward triangle markerdiamond: Diamond marker |
— |
outlier_fill |
value | Outlier interior color | — |
outlier_border_color |
color | Outlier border color | — |
outlier_border_width |
length / pt | Outlier border width; unitless values are pt | — |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.boxplotpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.boxplot(values=[1,2,2,3,4,4],position=2)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.violin#
Violin plot layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
values |
number[] | Observed samples for statistics, or bar values | — |
position |
value | Legend placement, statistical group position, or colorbar placement, depending on the owner | — |
data_width |
number / data | Width in data coordinates, independent of physical units | — |
bandwidth |
value | Positive kernel-density bandwidth | — |
points |
value | Point list; star uses an integer corner count, violin uses a KDE sample count | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.violinpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.violin(values=[1,1.5,2,2.2,3,4],position=2)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.ecdf#
Empirical cumulative distribution layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
values |
number[] | Observed samples for statistics, or bar values | — |
complementary |
value | Plot 1 minus the empirical CDF | false |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.ecdfpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.ecdf(values=[0.2,0.8,1.1,1.2,2.4,3.1])page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.heatmap#
Heatmap layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
z |
number[][] | Rectangular grid: rows are y and columns are x | — |
x_edges |
value | Increasing column edges, one more than the column count | — |
y_edges |
value | Increasing row edges, one more than the row count | — |
cmap |
string | color[] | cmap | Preset name, custom color list or cmap(...) handle | viridis |
vmin |
value | Minimum data value of the color mapping | — |
vmax |
value | Maximum data value of the color mapping | — |
color_scale |
color | Shared color_scale(...) object | — |
extent |
value | Data-grid bounds (xmin,xmax,ymin,ymax) | — |
origin |
"lower" | "upper" | Whether the first heatmap row is at the bottom or toplower: First row at the bottomupper: First row at the top |
lower |
mode |
"raster" | "vector" | Raster or vector heatmap cellsraster: Render heatmap cells as a rastervector: Render heatmap cells as vectors |
raster |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.heatmappage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.heatmap(z=[[1,2,3],[2,4,2],[1,3,1]],extent=(0,4,0,5),origin=lower)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.contour#
Contours layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
line_color |
color | Open-line color; defaults to series or theme color | — |
line_width |
length / pt | Open-line width; unitless values are pt | — |
line_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Line pattern; double/triple retain transparent gapsnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
line_dash |
length[] / pt | Alternating painted and blank lengths; unitless values are pt | — |
line_dash_offset |
length / pt | Line dash phase; unitless values are pt | 0 |
line_cap |
"butt" | "round" | "square" | Open endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
line_join |
"miter" | "round" | "bevel" | Line segment joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
line_miter_limit |
value | Maximum miter extension relative to line width | 4 |
line_opacity |
value | Independent line opacity, 0–1 | 1 |
z |
number[][] | Rectangular grid: rows are y and columns are x | — |
levels |
value | Increasing contour levels | — |
color_scale |
color | Shared color_scale(...) object | — |
cmap |
string | color[] | cmap | Preset name, custom color list or cmap(...) handle | viridis |
vmin |
value | Minimum data value of the color mapping | — |
vmax |
value | Maximum data value of the color mapping | — |
extent |
value | Data-grid bounds (xmin,xmax,ymin,ymax) | — |
periodic |
value | Close a regular polar field periodically | false |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.contourpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.contour(z=[[1,2,3],[2,4,2],[1,3,1]],levels=[1.5,2.5,3.5],extent=(0,4,0,5))page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.contourf#
Filled contours layer: add data to this plot, control its appearance with physical style parameters, and select data mappings with named-axis parameters.
Returns: A layer handle that can be included in a shared legend.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
axis | number[] | Cartesian horizontal axis configuration or layer x data | — |
y |
axis | number[] | Cartesian vertical axis configuration or layer y data | — |
x_axis |
value | Name of the horizontal axis bound to this layer | x |
y_axis |
value | Name of the vertical axis bound to this layer | y |
color |
color | Text color or base series color | — |
opacity |
number | number[] | Opacity from 0 to 1, multiplied by parent opacity | 1 |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
z |
number[][] | Rectangular grid: rows are y and columns are x | — |
levels |
value | Increasing contour levels | — |
color_scale |
color | Shared color_scale(...) object | — |
cmap |
string | color[] | cmap | Preset name, custom color list or cmap(...) handle | viridis |
vmin |
value | Minimum data value of the color mapping | — |
vmax |
value | Maximum data value of the color mapping | — |
fill |
paint | Interior color, gradient, pattern or image paint | none |
extent |
value | Data-grid bounds (xmin,xmax,ymin,ymax) | — |
periodic |
value | Close a regular polar field periodically | false |
theta |
axis | number[] | Polar angular axis configuration or angle data | — |
r |
axis | number[] | Polar radial axis configuration or radial data | — |
values |
number[] | Observed samples for statistics, or bar values | — |
theta_edges |
value | Polar-cell angular edges | — |
r_edges |
value | Polar-cell radial edges | — |
thetaerr |
value | Angular error values | — |
rerr |
value | Radial error values | — |
wrap |
"shortest" | "raw" | Connect across angular boundaries using shortest or rawshortest: Follow the shortest angular route across a periodraw: Keep original angular differences, including multiple turns |
shortest |
interpolation |
"polar" | "chord" | Polar interpolation or straight chord segmentspolar: Interpolate in polar data coordinates before projectionchord: Connect projected points with straight page chords |
polar |
closed |
boolean | Connect the first and last points | false |
Minimal complete example#
# Minimal complete example: plot.contourfpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.contourf(z=[[1,2,3],[2,4,2],[1,3,1]],levels=[1.5,2.5,3.5],extent=(0,4,0,5))page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
range#
Return a finite integer list excluding stop: one argument is stop, two are start/stop and three add step. step must be nonzero; at most 10,000 items.
Returns: integer[]
Positional parameters: start, stop, step.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
start |
integer | Start; a one-argument call means stop with start 0 | — |
stop |
integer | Exclusive stop | — |
step |
integer | Nonzero increment; default 1 | 1 |
Minimal complete example#
# Minimal complete example: rangepage=canvas(size=(100mm,75mm),background="#ffffff")for i in range(4) { page.add(rect(size=(10mm,10mm),fill="#087f8c"),offset=(10mm+i*16mm,20mm)) }Concepts and common errors · Composition source
len#
Return list, dictionary or geometry collection size, or string length.
Returns: integer
Positional parameters: value.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
value |
value | Input scalar, string or list element | — |
Minimal complete example#
# Minimal complete example: lenpage=canvas(size=(100mm,75mm),background="#ffffff")values=[1,2,3]page.add(text("Count: "+str(len(values))),offset=(10mm,10mm))Concepts and common errors · Composition source
append#
Return a copy of a list with one item appended, without mutating the input. Reassign the result when accumulating values.
Returns: list
Positional parameters: list, value.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
list |
value | Input list | — |
value |
value | Input scalar, string or list element | — |
Minimal complete example#
# Minimal complete example: appendpage=canvas(size=(100mm,75mm),background="#ffffff")values=append([1,2],3)page.add(text("New count: "+str(len(values))),offset=(10mm,10mm))Concepts and common errors · Composition source
str#
Convert supported numeric/boolean/string values to text, retaining length units. Use it in labels without evaluating arbitrary formatting expressions.
Returns: string
Positional parameters: value.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
value |
value | Input scalar, string or list element | — |
Minimal complete example#
# Minimal complete example: strpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(text("Measured: "+str(20mm)),offset=(10mm,10mm))Concepts and common errors · Composition source
abs#
Return absolute value while retaining numeric unit type. Accepts scalars or lengths, not material or lists.
Returns: number | length
Positional parameters: value.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
value |
value | Input scalar, string or list element | — |
Minimal complete example#
# Minimal complete example: abspage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(abs(-30mm),20mm),fill="#087f8c"),offset=(10mm,10mm))Concepts and common errors · Composition source
min#
Return the minimum of one or more values with compatible units. Input types must be compatible; the result retains units.
Returns: number | length
Positional parameters: values.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
values |
number[] | Observed samples for statistics, or bar values | — |
Minimal complete example#
# Minimal complete example: minpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(min(30mm,45mm),20mm),fill="#087f8c"),offset=(10mm,10mm))Concepts and common errors · Composition source
max#
Return the maximum of one or more values with compatible units. Input types must be compatible; the result retains units.
Returns: number | length
Positional parameters: values.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
values |
number[] | Observed samples for statistics, or bar values | — |
Minimal complete example#
# Minimal complete example: maxpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(max(30mm,45mm),20mm),fill="#087f8c"),offset=(10mm,10mm))Concepts and common errors · Composition source
move_to#
Create a command beginning a subpath at x/y without connecting it to the previous one. Use only inside path(commands=...).
Returns: path-command
Positional parameters: x, y.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
length / canvas unit | Endpoint x; current geometry unit | — |
y |
length / canvas unit | Endpoint y; current geometry unit | — |
Minimal complete example#
# Minimal complete example: move_topage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,10mm),line_to(30mm,10mm)],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
line_to#
Create a straight segment command from the current node to x/y. A preceding move_to is required; original node/segment identities are retained.
Returns: path-command
Positional parameters: x, y.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
x |
length / canvas unit | Endpoint x; current geometry unit | — |
y |
length / canvas unit | Endpoint y; current geometry unit | — |
Minimal complete example#
# Minimal complete example: line_topage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,10mm),line_to(30mm,10mm)],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
quad_to#
Create a quadratic Bezier segment: cx/cy is the control and x/y the endpoint. Controls usually lie off-curve; t differs from arc-length fraction.
Returns: path-command
Positional parameters: cx, cy, x, y.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
cx |
length / canvas unit | Original control cx; current geometry unit | — |
cy |
length / canvas unit | Original control cy; current geometry unit | — |
x |
length / canvas unit | Endpoint x; current geometry unit | — |
y |
length / canvas unit | Endpoint y; current geometry unit | — |
Minimal complete example#
# Minimal complete example: quad_topage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,20mm),quad_to(15mm,0mm,30mm,20mm)],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
cubic_to#
Create a cubic Bezier segment from two controls and an endpoint. controls queries retain originals and indices do not depend on render subdivisions.
Returns: path-command
Positional parameters: c1x, c1y, c2x, c2y, x, y.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
c1x |
length / canvas unit | Original control c1x; current geometry unit | — |
c1y |
length / canvas unit | Original control c1y; current geometry unit | — |
c2x |
length / canvas unit | Original control c2x; current geometry unit | — |
c2y |
length / canvas unit | Original control c2y; current geometry unit | — |
x |
length / canvas unit | Endpoint x; current geometry unit | — |
y |
length / canvas unit | Endpoint y; current geometry unit | — |
Minimal complete example#
# Minimal complete example: cubic_topage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,20mm),cubic_to(10mm,0mm,20mm,35mm,40mm,20mm)],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
arc_to#
Create an elliptical arc command with radii, rotation, large_arc/sweep flags and endpoint. One command remains one original logical segment.
Returns: path-command
Positional parameters: rx, ry, rotation, large_arc, sweep, x, y.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
rx |
length / canvas unit | Ellipse horizontal radius; current geometry unit | — |
ry |
length / canvas unit | Ellipse vertical radius; current geometry unit | — |
rotation |
angle / deg | Ellipse rotation; deg/rad, unitless degrees | 0deg |
large_arc |
boolean | Select the large arc | — |
sweep |
boolean | Traverse in the positive page-angle direction | — |
x |
length / canvas unit | Endpoint x; current geometry unit | — |
y |
length / canvas unit | Endpoint y; current geometry unit | — |
Minimal complete example#
# Minimal complete example: arc_topage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,20mm),arc_to(20mm,15mm,0deg,false,true,40mm,20mm)],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
close#
Create a command closing the current subpath to its start while preserving traversal. Closed start/end may coincide; seam-crossing intervals require explicit wrap=true.
Returns: path-command
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Minimal complete example: closepage=canvas(size=(100mm,75mm),background="#ffffff")page.add(path(commands=[move_to(0mm,0mm),line_to(30mm,0mm),line_to(15mm,20mm),close()],border_color="#087f8c",border_width=1mm),offset=(10mm,10mm))Concepts and common errors · Composition source
plot.legend#
Add legend decoration to an unplaced chart, using labeled layers by default. position uses chart-local coordinates; legend(layers=...) creates standalone material.
Returns: decoration
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
layers |
plot-layer[] | Existing layers represented by a shared legend | — |
style |
plot_style | plot_style(...) configuration; supplies defaults not overridden by explicit parameters | — |
position |
"top_left" | "top_center" | "top_right" | "middle_left" | "center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right" | (length,length) | Legend placement, statistical group position, or colorbar placement, depending on the ownertop_left: Top-left corner of the layout boxtop_center: Top-edge midpoint of the layout boxtop_right: Top-right corner of the layout boxmiddle_left: Left-edge midpoint of the layout boxcenter: Center alignmentmiddle_right: Right-edge midpoint of the layout boxbottom_left: Bottom-left corner of the layout boxbottom_center: Bottom-edge midpoint of the layout boxbottom_right: Bottom-right corner of the layout box |
top_right |
columns |
integer | Positive integer column count; row-major order | 1 |
font_size |
length / pt | Font size in pt when unitless; inherits when omitted | 继承 / inherit |
background |
paint | Background paint for the object region, separate from text or lines | #ffffff |
frame |
enum | boolean | axes/box/none for plot frames; boolean for legend frames | false |
title |
string | text | formula | Legend title with text or mathematics | — |
sample_width |
length / canvas unit | Physical legend-sample width | 6mm |
gap |
length / canvas unit | Physical legend-item or colorbar-to-plot gap | — |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 1.2mm |
sample_gap |
length / canvas unit | Physical gap between a legend sample and its label | — |
class |
string | Space-separated LCSS class names | "" |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: plot.legendpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))p.line(x=[0,1,2,3],y=[1,2,4,3],label="Signal")p.legend(position=top_left)page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
plot.colorbar#
Add an internal colorbar for a chart layer. A layer reference determines mapping; position/length are chart-local. Use colorbar(scale=...) for a shared standalone bar.
Returns: decoration
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
scale |
"linear" | "log" | "symlog" | linear/log/symlog axis transform, or shared color-scale objectlinear: Linear mappinglog: Logarithmic mapping; values must be positivesymlog: Linear near zero and logarithmic farther away |
— |
style |
plot_style | plot_style(...) configuration; supplies defaults not overridden by explicit parameters | — |
notation |
"plain" | "scientific" | "offset" | plain/scientific/offset number display without changing dataplain: Show tick numbers directlyscientific: Use scientific notation for ticksoffset: Show ticks with a shared offset |
plain |
format |
value | D3 numeric format, such as .2f or .2e | — |
exponent |
value | Integer decimal exponent for offset notation | — |
exponent_offset |
length / canvas unit | Physical offset of the multiplier from its default position | (0,0) |
label |
string | text | formula | Label: text, inline math, or a text definition | — |
label_offset |
length / canvas unit | Physical offset of an axis or colorbar title | (0,0) |
position |
"left" | "right" | "top" | "bottom" | (length,length) | Legend placement, statistical group position, or colorbar placement, depending on the ownerleft: Left side or left alignment, according to the parameterright: Right side or right alignment, according to the parametertop: Top sidebottom: Bottom side |
— |
orientation |
"vertical" | "horizontal" | vertical/horizontal orientationvertical: Vertical orientationhorizontal: Horizontal orientation |
vertical |
length |
length / canvas unit | Physical colorbar length | — |
thickness |
length / canvas unit | Physical colorbar thickness | 3mm |
gap |
length / canvas unit | Physical legend-item or colorbar-to-plot gap | — |
ticks |
number[] | Increasing, unique major tick data values | — |
class |
string | Space-separated LCSS class names | "" |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: plot.colorbarpage=canvas(size=(100mm,75mm),background="#ffffff")p=plot(size=(86mm,62mm),x=axis(range=(0,4)),y=axis(range=(0,5)))layer=p.heatmap(z=[[1,2],[3,4]],extent=(0,4,0,5))p.colorbar(layer,label="Value")page.add(p,offset=(7mm,6mm))Concepts and common errors · Composition source
ray#
Create a query ray with an origin and nonzero direction. The origin shares the path container; direction uses the selected measurement space.
Returns: ray
Required: origin, direction.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
origin |
"lower" | "upper" | Anchor or coordinates in the containerlower: First row at the bottomupper: First row at the top |
— |
direction |
(number, number) | Nonzero direction in the selected measurement space | — |
Minimal complete example#
# Minimal complete example: raypage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.intersections(ray(origin=(0mm,30mm),direction=(1,0)))for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.at#
Select by arc-length fraction or distance. Original parameter t requires segments[i]. Lengths use placed geometry by default.
Returns: path_anchor
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
fraction |
number | Arc-length fraction, 0–1 | — |
distance |
length / canvas unit | Nonnegative arc length from the selected start, no greater than route length; exclusive with fraction/t | — |
t |
number | Original segment parameter, 0–1 | — |
Minimal complete example#
# Minimal complete example: path.atpage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")point=route.at(fraction=0.5)page.add(dot,anchor=center,target=point)Concepts and common errors · Composition source
path.nearest#
Return all globally nearest path positions in source order. Explicit indexing is required; infinitely many nearest points are diagnosed.
Returns: anchor_collection
Required: to.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
to |
anchor | (length, length) | Reference anchor or coordinates in the same container | — |
Minimal complete example#
# Minimal complete example: path.nearestpage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.nearest(to=curve.bounds.top_left)for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.extrema#
Return local coordinate extrema in the selected space, excluding ordinary endpoints and constant intervals.
Returns: anchor_collection
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
axis |
"x" | "y" | Query x or y extremax: Horizontal coordinate in the selected spacey: Vertical coordinate in the selected space |
"y" |
Minimal complete example#
# Minimal complete example: path.extremapage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.extrema(axis=y)for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.inflections#
Return smooth inflections where signed curvature changes sign.
Returns: anchor_collection
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Minimal complete example: path.inflectionspage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.inflections()for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.corners#
Return nonsmooth joining nodes; choose direction explicitly with with_side.
Returns: anchor_collection
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Minimal complete example: path.cornerspage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.corners()for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.intersections#
Return all path positions intersecting a ray. Preserve distinct self-intersection occurrences and diagnose continuous overlap.
Returns: anchor_collection
Positional parameters: ray.
Required: ray.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
ray |
ray | Ray created with ray(...) | — |
Minimal complete example#
# Minimal complete example: path.intersectionspage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")candidates=route.intersections(ray(origin=(0mm,30mm),direction=(1,0)))for point in candidates { page.add(dot,anchor=center,target=point) }page.add(text("Candidates: "+str(len(candidates))),offset=(8mm,65mm))Concepts and common errors · Composition source
path.between#
Select a continuous interval in traversal order. Endpoints must belong to the same instance and subpath.
Returns: geometry_path
Positional parameters: start, end.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
start |
path_anchor | Starting path position | — |
end |
path_anchor | Ending path position | — |
wrap |
boolean | Explicitly enable crossing a closed seam | false |
Minimal complete example#
# Minimal complete example: path.betweenpage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")point=route.between(route.nodes[1],route.nodes[3]).at(fraction=0.5)page.add(dot,anchor=center,target=point)Concepts and common errors · Composition source
path.in_space#
Choose the measurement space for lengths, nearest points and features. Resulting anchors remain in the current container.
Returns: geometry_path
Positional parameters: space.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
space |
"local" | "parent" | local measures original geometry; parent measures in the current containerlocal: Measure original local geometry; return container-coordinate anchorsparent: Measure placed geometry in container coordinates |
— |
Minimal complete example#
# Minimal complete example: path.in_spacepage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")point=route.in_space(local).at(fraction=0.5)page.add(dot,anchor=center,target=point)Concepts and common errors · Composition source
anchor.with_side#
Choose the incoming or outgoing direction at a corner. The positive normal is the left side along traversal.
Returns: path_anchor
Positional parameters: side.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
side |
"incoming" | "outgoing" | Select incoming or outgoing directionincoming: Use the incoming tangent at the path positionoutgoing: Use the outgoing tangent at the path position |
— |
Minimal complete example#
# Minimal complete example: anchor.with_sidepage=canvas(size=(100mm,75mm),background="#ffffff")curve=page.add(path(commands=[move_to(0mm,0mm),cubic_to(0mm,0mm,0mm,35mm,50mm,35mm),cubic_to(65mm,35mm,70mm,0mm,75mm,0mm),line_to(82mm,12mm)],border_color="#0072b2",border_width=0.7mm),offset=(8mm,15mm))route=curve.path.subpaths[0]dot=ellipse(size=(2mm,2mm),fill="#e36b70")corner=route.corners()[0].with_side(incoming)page.add(line(length=8mm,line_color="#e36b70"),anchor=self.path.start,target=corner,rotation=corner.tangent_angle)Concepts and common errors · Composition source
head#
Reusable endpoint head configuration, not a placeable material. size gives along-direction and transverse physical dimensions.
Returns: head
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
shape |
"triangle" | "open" | "stealth" | "dot" | "diamond" | "bar" | Preset head shapetriangle: Closed triangular head; tip coincides with the logical endpointopen: Open V head; the shaft remains insidestealth: Closed concave head; tip coincides with the logical endpointdot: Elliptical head centered on the endpointdiamond: Diamond head centered on the endpointbar: Rectangular head centered on the endpoint |
triangle |
size |
(length,length) / canvas unit | Head size retained on short lines; defaults derive from line width | — |
fill |
color | Fill; closed heads inherit line color, open heads default to none | — |
border_color |
color | Outline color; open heads inherit line color | — |
border_width |
length / pt | Outline width; open heads inherit line width | — |
opacity |
value | Head opacity, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: headpage=canvas(size=(100mm,75mm),background="#ffffff")h=head(shape=diamond,size=(6mm,5mm),fill="#e36b70")page.add(line(length=50mm,end_head=h,line_width=1.5mm),offset=(12mm,25mm))Concepts and common errors · Composition source
rgb#
Create a RGB color with alpha=0–1.
Returns: color
Positional parameters: r, g, b.
Required: r, g, b.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
r |
number | sRGB r channel, 0–255; fractions are retained, alpha is separate | — |
g |
number | sRGB g channel, 0–255; fractions are retained, alpha is separate | — |
b |
number | sRGB b channel, 0–255; fractions are retained, alpha is separate | — |
alpha |
number | Color alpha, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: rgbpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(60mm,30mm),fill=rgb(255,80,40,alpha=0.6)),offset=(10mm,10mm))Concepts and common errors · Composition source
hsv#
Create a HSV color with alpha=0–1.
Returns: color
Positional parameters: h, s, v.
Required: h, s, v.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
h |
angle / deg | Hue: deg/rad, unitless degrees; normalized modulo 360 degrees | — |
s |
number | Saturation, 0–1; the panel displays a percentage | — |
v |
number | Value, 0–1; the panel displays a percentage | — |
alpha |
number | Color alpha, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: hsvpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(60mm,30mm),fill=hsv(200deg,0.7,0.8,alpha=0.6)),offset=(10mm,10mm))Concepts and common errors · Composition source
oklch#
Create a OKLCH color with alpha=0–1.
Returns: color
Positional parameters: l, c, h.
Required: l, c, h.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
l |
number | Perceptual lightness, 0–1; percentage in the panel | — |
c |
number | Nonnegative chroma; out-of-sRGB colors retain lightness/hue while chroma is reduced | — |
h |
angle / deg | Hue: deg/rad, unitless degrees; normalized modulo 360 degrees | — |
alpha |
number | Color alpha, 0–1 | 1 |
Minimal complete example#
# Minimal complete example: oklchpage=canvas(size=(100mm,75mm),background="#ffffff")page.add(rect(size=(60mm,30mm),fill=oklch(0.7,0.15,200deg,alpha=0.6)),offset=(10mm,10mm))Concepts and common errors · Composition source
dict#
Create an empty dictionary or load an ordered nested JSON object; table validation remains strict.
Returns: dict
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Path to a JSON object file | — |
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
enumerate#
Return index/value pairs for loop unpacking; start defaults to zero and input is limited to 10,000 items.
Returns: list
Positional parameters: seq, start.
Required: seq.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
seq |
iterable | List, dictionary or geometry collection | — |
start |
integer | Initial index | 0 |
Minimal complete example#
# Insertion order controls the layout; assigning a dictionary copies its values.page=canvas(size=(150mm,90mm),background="#ffffff")labels=dict()labels["B"]="Baseline"labels["A"]="Annealed"copy=labelscopy["B"]="Changed copy"labels=labels.update({"C":"Cold worked"})keys=labels.keys()values=labels.values()items=labels.items()default=labels.get("missing","No data")colors=["#0072b2","#d55e00","#009e73"]for i,(key,value) in enumerate(items) { card=group() card.add(rect(size=(42mm,55mm),fill=colors[i])) card.add(text(content=key,font_family="DejaVu Sans",font_size=20pt,color="#ffffff"),offset=(5mm,7mm)) card.add(text(content=value,font_family="DejaVu Sans",font_size=8pt,color="#ffffff"),offset=(5mm,35mm)) page.add(card,offset=(5mm+i*48mm,10mm))}for i,(key,value) in enumerate(zip(keys,values)) { page.add(text(content=f"{i+1}. {key} = {value}",font_family="DejaVu Sans",font_size=8pt),offset=(5mm+i*48mm,72mm))}Concepts and common errors · Composition source
zip#
Combine positional iterable inputs into tuples, stopping at the shortest input; no arguments return an empty list.
Returns: list
Positional parameters: sequences.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
sequences |
iterable... | Lists, dictionaries or geometry collections | — |
Minimal complete example#
# Insertion order controls the layout; assigning a dictionary copies its values.page=canvas(size=(150mm,90mm),background="#ffffff")labels=dict()labels["B"]="Baseline"labels["A"]="Annealed"copy=labelscopy["B"]="Changed copy"labels=labels.update({"C":"Cold worked"})keys=labels.keys()values=labels.values()items=labels.items()default=labels.get("missing","No data")colors=["#0072b2","#d55e00","#009e73"]for i,(key,value) in enumerate(items) { card=group() card.add(rect(size=(42mm,55mm),fill=colors[i])) card.add(text(content=key,font_family="DejaVu Sans",font_size=20pt,color="#ffffff"),offset=(5mm,7mm)) card.add(text(content=value,font_family="DejaVu Sans",font_size=8pt,color="#ffffff"),offset=(5mm,35mm)) page.add(card,offset=(5mm+i*48mm,10mm))}for i,(key,value) in enumerate(zip(keys,values)) { page.add(text(content=f"{i+1}. {key} = {value}",font_family="DejaVu Sans",font_size=8pt),offset=(5mm+i*48mm,72mm))}Concepts and common errors · Composition source
cmap#
Get an immutable named Matplotlib 3.11.2 colormap for sampling, palette lists and reversal.
Returns: cmap
Positional parameters: name.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Preset name, including _r and native aliases | viridis |
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
cmap_names#
List canonical colormap names, optionally filtered by category and including reversed names; aliases are omitted.
Returns: list
Positional parameters: category, reversed.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
category |
string | null | sequential/diverging/cyclic/qualitative/misc; null lists all | null |
reversed |
boolean | Whether to include _r names | false |
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
palette#
Create a palette: categorical colors cycle in native order, sequential colors sample evenly, and cyclic maps omit the repeated endpoint.
Returns: list
Positional parameters: name, n.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Preset name | tab10 |
n |
integer | null | 0–10,000; null uses the native LUT size | null |
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
dict.keys#
Return dictionary keys as a list in insertion order.
Returns: list
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
dict.values#
Return values in insertion order, preserving units and object types.
Returns: list
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
dict.items#
Return key/value pairs in insertion order for loop unpacking.
Returns: list
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
dict.get#
Look up a string key; return default when missing, or null by default.
Returns: value
Positional parameters: key, default.
Required: key.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
key |
string | Dictionary key | — |
default |
value | Default for a missing key | null |
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
dict.update#
Return a merged dictionary; existing keys keep their position and new keys append. The original remains unchanged.
Returns: dict
Positional parameters: other.
Required: other.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
other |
dict | Dictionary to merge | — |
Minimal complete example#
# Ordered value dictionaries, safe updates and pair unpacking.page=canvas(size=(100mm,70mm),background="#ffffff")d=dict()d["B"]={"label":"Beta","color":"#0072b2"}d["A"]={"label":"Alpha","color":"#d55e00"}copy=dcopy["B"]["label"]="Copy"d=d.update({"C":{"label":"Gamma","color":"#009e73"}})keys=d.keys()values=d.values()items=d.items()fallback=d.get("missing",{"label":"Default"})for i,(name,value) in enumerate(items) { if name in d { page.add(rect(size=(18mm,8mm),fill=value["color"]),offset=(8mm,8mm+i*18mm)) page.add(text(content=f"{name}: {value['label']}",font_family="DejaVu Sans",font_size=10pt),offset=(30mm,8mm+i*18mm)) }}Concepts and common errors · Composition source
cmap.sample#
Sample a finite normalized position, clamping values outside zero to one.
Returns: color
Positional parameters: t.
Required: t.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
t |
number | Finite normalized position | — |
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
cmap.colors#
Return a palette with native size by default; categorical colors cycle, sequential maps sample evenly and cyclic maps omit the repeated endpoint.
Returns: list
Positional parameters: n.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
n |
integer | null | 0–10,000; null uses native size | null |
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
cmap.reversed#
Return a reversed colormap using Matplotlib native reversed lookup tables.
Returns: cmap
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|
Minimal complete example#
# Preset discovery, sampling, colors and immutable reversal.page=canvas(size=(100mm,60mm),background="#ffffff")cm=cmap("viridis")names=cmap_names(category="sequential")colors=cm.colors(8)reverse=cm.reversed()accent=cm.sample(0.5)cycle=palette("tab10",8)for i,color in enumerate(colors) { page.add(rect(size=(10mm,12mm),fill=color),offset=(10mm+i*10mm,8mm)) page.add(rect(size=(10mm,12mm),fill=reverse.sample(i/7)),offset=(10mm+i*10mm,24mm)) page.add(rect(size=(10mm,8mm),fill=cycle[i]),offset=(10mm+i*10mm,40mm))}Concepts and common errors · Composition source
shadow#
阴影 / Alpha-based shadow
Returns: shadow
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
color |
color | color | #000000 |
opacity |
value | opacity | 0.5 |
blur |
length / canvas unit | blur | 1mm |
spread |
length / canvas unit | spread | 0mm |
mode |
"outer" | "inner" | modeouter: outerinner: inner |
outer |
target |
"content" | "object" | targetcontent: contentobject: object |
content |
offset |
(length,length) / canvas unit | offset | (1mm,1mm) |
Minimal complete example#
page=canvas(size=(150mm,95mm),background="#202936")page.add(rect(size=(35mm,25mm),border_radius=4mm,fill="#3782d6",effects=[shadow(blur=2mm,offset=(2mm,3mm)),glow(color="#59b7ff",blur=1mm,spread=0.5mm)]),offset=(12mm,15mm))page.add(ellipse(size=(35mm,25mm),fill="#eb6d9b",effects=[shadow(mode="inner",blur=2mm,offset=(2mm,2mm),opacity=0.8),glow(mode="inner",color="#ffe9f2",blur=1mm)]),offset=(58mm,15mm))page.add(text("Mixed effects",font_family="DejaVu Sans",font_size=25pt,color="#f6f6f6",effects=[glow(color="#8d6cff",blur=1mm),shadow(blur=0.5mm,offset=(1mm,1mm))]),offset=(18mm,59mm))Concepts and common errors · Composition source
glow#
发光 / Alpha-based glow
Returns: glow
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
color |
color | color | #ffffff |
opacity |
value | opacity | 1 |
blur |
length / canvas unit | blur | 1mm |
spread |
length / canvas unit | spread | 0mm |
mode |
"outer" | "inner" | modeouter: outerinner: inner |
outer |
target |
"content" | "object" | targetcontent: contentobject: object |
content |
Minimal complete example#
page=canvas(size=(150mm,95mm),background="#202936")page.add(rect(size=(35mm,25mm),border_radius=4mm,fill="#3782d6",effects=[shadow(blur=2mm,offset=(2mm,3mm)),glow(color="#59b7ff",blur=1mm,spread=0.5mm)]),offset=(12mm,15mm))page.add(ellipse(size=(35mm,25mm),fill="#eb6d9b",effects=[shadow(mode="inner",blur=2mm,offset=(2mm,2mm),opacity=0.8),glow(mode="inner",color="#ffe9f2",blur=1mm)]),offset=(58mm,15mm))page.add(text("Mixed effects",font_family="DejaVu Sans",font_size=25pt,color="#f6f6f6",effects=[glow(color="#8d6cff",blur=1mm),shadow(blur=0.5mm,offset=(1mm,1mm))]),offset=(18mm,59mm))Concepts and common errors · Composition source
text_path#
沿本地单条开放路径排字 / Typeset on one local open path
Returns: text_path
Positional parameters: path.
Required: path.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
path |
material | path | — |
start |
length / canvas unit | start | 0mm |
align |
"left" | "center" | "right" | alignleft: leftcenter: centerright: right |
left |
reverse |
boolean | reverse | false |
Minimal complete example#
page=canvas(size=(180mm,150mm),background="#f3f5f9")font="DejaVu Sans"paint=linear_gradient(stops=[(0,"#ea366d"),(1,"#365de6")],start=(0,0),end=(1,0))page.add(text("LayMesh 0.4.0",font_family=font,font_size=30pt,font_weight=700,text_fill=paint,text_stroke_color="#ffffff",text_stroke_width=0.7pt,extrude=text_extrude(depth=1.4mm,angle=45deg,color="#213864"),effects=[shadow(blur=0.8mm,offset=(1mm,2mm))]),offset=(10mm,8mm))route=path(commands=[move_to(0mm,12mm),cubic_to(35mm,0mm,95mm,0mm,130mm,12mm)])page.add(text("Text follows a curved path",font_family=font,font_size=17pt,path=text_path(route,align="center"),color="#3255b7"),offset=(20mm,32mm))page.add(text("ARC LETTERS",font_family=font,font_size=25pt,font_weight=700,warp=text_warp("arc",angle=55deg),text_fill=paint),offset=(30mm,62mm))page.add(text("Wave and glow",font_family=font,font_size=23pt,warp=text_warp("wave",amplitude=2mm,wavelength=30mm),color="#213864",effects=[glow(color="#4a8eff",blur=0.7mm,spread=0.2mm)]),offset=(25mm,88mm))page.add(text("PERSPECTIVE",font_family=font,font_size=26pt,font_weight=700,warp=text_warp("perspective",corners=[(0mm,2mm),(85mm,0mm),(75mm,12mm),(8mm,9mm)]),text_fill=paint,extrude=text_extrude(depth=1mm,color="#324165")),offset=(35mm,113mm))Concepts and common errors · Composition source
text_warp#
弧形、波浪或四角透视变形 / Arc, wave or perspective warp
Returns: text_warp
Positional parameters: kind.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
kind |
"arc" | "wave" | "perspective" | kindarc: arcwave: waveperspective: perspective |
arc |
angle |
angle | angle | 45deg |
amplitude |
length / canvas unit | amplitude | 2mm |
wavelength |
length / canvas unit | wavelength | 20mm |
phase |
angle | phase | 0deg |
corners |
(length,length)[] / canvas unit | corners | — |
Minimal complete example#
page=canvas(size=(180mm,150mm),background="#f3f5f9")font="DejaVu Sans"paint=linear_gradient(stops=[(0,"#ea366d"),(1,"#365de6")],start=(0,0),end=(1,0))page.add(text("LayMesh 0.4.0",font_family=font,font_size=30pt,font_weight=700,text_fill=paint,text_stroke_color="#ffffff",text_stroke_width=0.7pt,extrude=text_extrude(depth=1.4mm,angle=45deg,color="#213864"),effects=[shadow(blur=0.8mm,offset=(1mm,2mm))]),offset=(10mm,8mm))route=path(commands=[move_to(0mm,12mm),cubic_to(35mm,0mm,95mm,0mm,130mm,12mm)])page.add(text("Text follows a curved path",font_family=font,font_size=17pt,path=text_path(route,align="center"),color="#3255b7"),offset=(20mm,32mm))page.add(text("ARC LETTERS",font_family=font,font_size=25pt,font_weight=700,warp=text_warp("arc",angle=55deg),text_fill=paint),offset=(30mm,62mm))page.add(text("Wave and glow",font_family=font,font_size=23pt,warp=text_warp("wave",amplitude=2mm,wavelength=30mm),color="#213864",effects=[glow(color="#4a8eff",blur=0.7mm,spread=0.2mm)]),offset=(25mm,88mm))page.add(text("PERSPECTIVE",font_family=font,font_size=26pt,font_weight=700,warp=text_warp("perspective",corners=[(0mm,2mm),(85mm,0mm),(75mm,12mm),(8mm,9mm)]),text_fill=paint,extrude=text_extrude(depth=1mm,color="#324165")),offset=(35mm,113mm))Concepts and common errors · Composition source
text_extrude#
二维矢量挤出 / Two-dimensional vector extrusion
Returns: text_extrude
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
depth |
length / canvas unit | depth | 1mm |
angle |
angle | angle | 45deg |
color |
color | color | #555555 |
Minimal complete example#
page=canvas(size=(180mm,150mm),background="#f3f5f9")font="DejaVu Sans"paint=linear_gradient(stops=[(0,"#ea366d"),(1,"#365de6")],start=(0,0),end=(1,0))page.add(text("LayMesh 0.4.0",font_family=font,font_size=30pt,font_weight=700,text_fill=paint,text_stroke_color="#ffffff",text_stroke_width=0.7pt,extrude=text_extrude(depth=1.4mm,angle=45deg,color="#213864"),effects=[shadow(blur=0.8mm,offset=(1mm,2mm))]),offset=(10mm,8mm))route=path(commands=[move_to(0mm,12mm),cubic_to(35mm,0mm,95mm,0mm,130mm,12mm)])page.add(text("Text follows a curved path",font_family=font,font_size=17pt,path=text_path(route,align="center"),color="#3255b7"),offset=(20mm,32mm))page.add(text("ARC LETTERS",font_family=font,font_size=25pt,font_weight=700,warp=text_warp("arc",angle=55deg),text_fill=paint),offset=(30mm,62mm))page.add(text("Wave and glow",font_family=font,font_size=23pt,warp=text_warp("wave",amplitude=2mm,wavelength=30mm),color="#213864",effects=[glow(color="#4a8eff",blur=0.7mm,spread=0.2mm)]),offset=(25mm,88mm))page.add(text("PERSPECTIVE",font_family=font,font_size=26pt,font_weight=700,warp=text_warp("perspective",corners=[(0mm,2mm),(85mm,0mm),(75mm,12mm),(8mm,9mm)]),text_fill=paint,extrude=text_extrude(depth=1mm,color="#324165")),offset=(35mm,113mm))Concepts and common errors · Composition source
arrow#
Create a reusable filled straight arrow. Connect anchors using start/end in add, and style with fill, border_* and effects.
Returns: Reusable filled arrow material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
length |
length / canvas unit | Nonnegative line length; mutually exclusive with dx/dy | — |
angle |
angle / deg | Local direction: 0 right, 90 down; required explicitly for zero length | 0deg |
dx |
length / canvas unit | Horizontal line displacement; requires dy, exclusive with length/angle | — |
dy |
length / canvas unit | Vertical line displacement; requires dx, exclusive with length/angle | — |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow(length=50mm,shaft_width=(2mm,5mm),fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)centerline_length = a.centerline.lengthConcepts and common errors · Composition source
arrow.arc#
Append straight triangular heads along an arc shaft’s endpoint tangents. The total sweep includes heads; connections solve for the complete endpoints.
Returns: Reusable filled arrow material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
radius |
length / canvas unit | Radius of the arc shaft centerline; positive locally, signed for clockwise/counterclockwise minor connections. Endpoint constraints include heads | — |
start_angle |
angle | Polar angle of the final logical start around the circle center; solved from endpoints for connections | 0deg |
sweep_angle |
angle | Total polar sweep including heads; positive clockwise, 0 < absolute value < 360deg, with positive remaining shaft sweep | — |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(150mm,95mm),background="#ffffff")a=page.add(arrow.arc(radius=22mm,start_angle=0deg,sweep_angle=240deg,fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)# Signed-radius endpoint connections select clockwise / counterclockwise minor arcs.page.add(arrow.arc(radius=45mm,fill="#ee784b"),start=(75mm,40mm),end=(135mm,40mm))page.add(arrow.arc(radius=-45mm,fill="#5273c5"),start=(75mm,60mm),end=(135mm,60mm))Concepts and common errors · Composition source
arrow.bent#
Create an L-shaped arrow with centerline span and corner radius, optionally connected between anchors.
Returns: Reusable filled arrow material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
span |
(length,length) / canvas unit | Horizontal and vertical centerline span | (30mm,20mm) |
corner_radius |
length / canvas unit | Centerline corner radius; zero makes a sharp corner | min(span)/4 |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow.bent(span=(40mm,25mm),corner_radius=8mm,fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)Concepts and common errors · Composition source
arrow.uturn#
Create a U-turn arrow. Endpoint connections transform its centerline while retaining physical shaft and head dimensions.
Returns: Reusable filled arrow material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
span |
(length,length) / canvas unit | Horizontal and vertical centerline span | (30mm,20mm) |
corner_radius |
length / canvas unit | Centerline corner radius; zero makes a sharp corner | min(span)/4 |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow.uturn(span=(35mm,25mm),heads=both,fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)Concepts and common errors · Composition source
arrow.chevron#
Create a single-headed notched arrow whose tail and shaft share one continuous closed silhouette.
Returns: Reusable filled arrow material.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
length |
length / canvas unit | Nonnegative line length; mutually exclusive with dx/dy | — |
angle |
angle / deg | Local direction: 0 right, 90 down; required explicitly for zero length | 0deg |
dx |
length / canvas unit | Horizontal line displacement; requires dy, exclusive with length/angle | — |
dy |
length / canvas unit | Vertical line displacement; requires dx, exclusive with length/angle | — |
notch_depth |
length / canvas unit | Notch depth at the unheaded tail | tail shaft width |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow.chevron(length=50mm,shaft_width=5mm,fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)Concepts and common errors · Composition source
arrow.path#
Preserve a complete custom open path as the shaft and append straight triangular heads along its outward endpoint tangents; supports variable width and independent head sizes.
Returns: Reusable filled arrow material.
Required: path.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
path |
material | One open path material with its original curve segments preserved; source endpoints are necks and tips extend outward | — |
shaft_width |
length | (length,length) | (number,length)[] | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation | 3mm |
heads |
"start" | "end" | "both" | Head endpoints; chevrons support one head onlystart: Start headend: End headboth: Both heads |
end |
head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | twice the corresponding neck width |
start_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
end_head_size |
(length,length) / canvas unit | Head longitudinal length and transverse width; endpoint sizes override head_size | head_size |
class |
string | Space-separated LCSS class names | "" |
fill |
paint | Interior color, gradient, pattern or image paint | #000000 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
three_d |
three_d | Object-level 3D appearance | none |
Minimal complete example#
page=canvas(size=(85mm,70mm),background="#ffffff")a=page.add(arrow.path(path=path(commands=[move_to(0,20),cubic_to(15,20,25,0,50,0)]),shaft_width=[(0,2mm),(0.5,5mm),(1,3mm)],fill="#087f8c"),offset=(10mm,10mm))page.add(ellipse(size=(1mm,1mm),fill="#ee784b"),anchor=center,target=a.centerline.end)Concepts and common errors · Composition source
step#
Create a presentation step; actions run in parallel, followed by a 1s hold.
Returns: Presentation step
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
name |
string | Step name | — |
duration |
time / time | Finite presentation window; required for infinite or paused effects | — |
hold |
time / time | Hold after animation window | 1s |
start |
"click" | "after-previous" | click: manual trigger; after-previous: start after the previous step hold, or on page entry for the first step.click: Start when the user advances.after-previous: Start after the previous step hold; the first step starts on page entry. |
click |
Minimal complete example#
page = canvas(size=(160mm, 90mm), stylesheet="motion.lcss", background="#f4f5f9")title = page.add(text("研究结果 · Results", class="title-motion", font_size=24pt), offset=(12mm, 12mm))card = page.add(rect(size=(48mm, 30mm), fill="#3978d4", border_color="none"), offset=(12mm, 35mm))label = page.add(text("LCSS + Animate.css", font_size=13pt), offset=(74mm, 42mm))curve = page.add(line(length=69mm, line_color="#3978d4", line_width=2pt), offset=(74mm, 58mm))s1 = page.step(name="标题入场 · Title", hold=1s)s1.animate(title, class="animate__animated animate__fadeInUp")s2 = page.step(name="三维翻转 · Flip", hold=1s)s2.animate(card, class="animate__animated animate__flipInY")s2.animate(label, class="animate__animated animate__fadeInRight", delay=200ms)s3 = page.step(name="描线 · Draw", hold=1s)s3.animate(curve, class="draw-motion")s4 = page.step(name="强调 · Emphasis", hold=1s)s4.animate(title, class="animate__animated animate__pulse", duration=600ms)Concepts and common errors · Composition source
animate#
Animate a placed instance in this step. Temporary classes supply CSS values; explicit arguments override them.
Returns: No return value
Positional parameters: target.
Required: target.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
target |
instance | Placed instance returned by add() | — |
class |
string | Temporary CSS class list | — |
name |
string | Reference @keyframes by name | — |
duration |
time / time | Iteration duration | — |
delay |
time / time | Delay, including negative times | — |
easing |
string | CSS timing function | — |
iterations |
number | string | Iteration count or infinite | — |
direction |
string | CSS animation direction | — |
fill |
string | CSS fill mode | — |
vars |
dict | CSS custom property overrides | — |
play_state |
string | CSS play state | — |
start |
"step" | "with-previous" | "after-previous" | step, with-previous, or after-previous. Delay is relative to the selected action boundary.step: Use the current step start.with-previous: Use the previous action start.after-previous: Use the previous action end; the preceding action must have a finite duration. |
step |
Minimal complete example#
page = canvas(size=(160mm, 90mm), stylesheet="motion.lcss", background="#f4f5f9")title = page.add(text("研究结果 · Results", class="title-motion", font_size=24pt), offset=(12mm, 12mm))card = page.add(rect(size=(48mm, 30mm), fill="#3978d4", border_color="none"), offset=(12mm, 35mm))label = page.add(text("LCSS + Animate.css", font_size=13pt), offset=(74mm, 42mm))curve = page.add(line(length=69mm, line_color="#3978d4", line_width=2pt), offset=(74mm, 58mm))s1 = page.step(name="标题入场 · Title", hold=1s)s1.animate(title, class="animate__animated animate__fadeInUp")s2 = page.step(name="三维翻转 · Flip", hold=1s)s2.animate(card, class="animate__animated animate__flipInY")s2.animate(label, class="animate__animated animate__fadeInRight", delay=200ms)s3 = page.step(name="描线 · Draw", hold=1s)s3.animate(curve, class="draw-motion")s4 = page.step(name="强调 · Emphasis", hold=1s)s4.animate(title, class="animate__animated animate__pulse", duration=600ms)Concepts and common errors · Composition source
video#
Define local video material, place with add, and bind playback using canvas.play or step.play.
Returns: material
Positional parameters: src.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
size |
(length | auto, length | auto) / canvas unit | Physical (width,height); auto preserves aspect or natural layout | — |
class |
string | Space-separated LCSS class names | "" |
background |
paint | Background paint for the object region, separate from text or lines | none |
padding |
length | length[] / canvas unit | Inner spacing; one value or top, right, bottom, left | 0 |
border_radius |
length / canvas unit | Physical corner radius of the box | 0 |
border_color |
color | Closed-outline color; none disables the border | none |
border_width |
length / pt | Closed-outline width; unitless values are pt | — |
border_style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" | Border line pattern, independent of fillnone: Do not draw this itemsolid: Continuous solid strokedashed: Dashed stroke; explicit dash values override the patterndotted: Dotted strokedash_dot: Dash-dot strokedouble: Double compound stroketriple: Triple compound stroke |
solid |
border_dash |
length[] / pt | Alternating border segments and gaps, in pairs | — |
border_dash_offset |
length / pt | Border dash phase; unitless values are pt | 0 |
border_cap |
"butt" | "round" | "square" | Outline dash endpoint shapebutt: Flat cap; does not extend beyond the endpointround: Round cap; extends half the stroke widthsquare: Square cap; extends half the stroke width |
butt |
border_join |
"miter" | "round" | "bevel" | Outline joinmiter: Extend edges to a pointed join, subject to the miter limitround: Join adjacent stroke edges with a circular arcbevel: Cut off the corner with a straight edge |
miter |
border_miter_limit |
value | Maximum miter extension relative to line width | 4 |
border_opacity |
value | Independent border opacity, 0–1 | 1 |
effects |
effect[] | Shadow, glow, reflection and soft-edge effects | [] |
poster |
string | Optional poster image path | — |
Minimal complete example#
p=canvas(size=(100mm,65mm),background="#f4f5f7")v=p.add(video(src="demo.mp4"),size=(80mm,45mm),offset=(10mm,5mm))p.add(text("Video + audio",font_size=4mm),offset=(10mm,55mm))p.play(v)p.play(audio(src="music.wav"),loop=true,volume=0.2)s=p.step(duration=3s,hold=0s,start="after-previous")Concepts and common errors · Composition source
audio#
Define local audio for canvas.play, step.play or document.play.
Returns: audio material
Positional parameters: src.
Required: src.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
src |
string | Local resource path relative to the defining file | — |
Minimal complete example#
p=canvas(size=(100mm,65mm),background="#f4f5f7")v=p.add(video(src="demo.mp4"),size=(80mm,45mm),offset=(10mm,5mm))p.add(text("Video + audio",font_size=4mm),offset=(10mm,55mm))p.play(v)p.play(audio(src="music.wav"),loop=true,volume=0.2)s=p.step(duration=3s,hold=0s,start="after-previous")Concepts and common errors · Composition source
canvas.play#
Bind page, step or document playback using an independent media clock.
Returns: none
Positional parameters: target.
Required: target.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
target |
instance | audio | Placed video instance or audio material | — |
trigger |
"auto" | "click" | Start automatically with the page/step, or independently on a video click.auto: Start with the page, step or documentclick: Toggle the video independently by clicking |
— |
delay |
time / s/ms | Delay after the start condition is met, in s/ms. | — |
trim_start |
time / s/ms | Absolute source time at the start of the clip, in s/ms. | — |
trim_end |
time / s/ms | Absolute source time at the end of the clip, in s/ms. | — |
loop |
bool | Loop the trimmed source interval. | — |
volume |
number | Playback volume from 0 to 1; defaults to 1. | — |
muted |
bool | Mute the track while retaining video frames. | — |
export_start |
time / s/ms | Explicit page-local MP4 start time for click-triggered video, in s/ms. | — |
Minimal complete example#
p=canvas(size=(100mm,65mm),background="#f4f5f7")v=p.add(video(src="demo.mp4"),size=(80mm,45mm),offset=(10mm,5mm))p.add(text("Video + audio",font_size=4mm),offset=(10mm,55mm))p.play(v)p.play(audio(src="music.wav"),loop=true,volume=0.2)s=p.step(duration=3s,hold=0s,start="after-previous")Concepts and common errors · Composition source
step.play#
Bind page, step or document playback using an independent media clock.
Returns: none
Positional parameters: target.
Required: target.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
target |
instance | audio | Placed video instance or audio material | — |
trigger |
"auto" | "click" | Start automatically with the page/step, or independently on a video click.auto: Start with the page, step or documentclick: Toggle the video independently by clicking |
— |
delay |
time / s/ms | Delay after the start condition is met, in s/ms. | — |
trim_start |
time / s/ms | Absolute source time at the start of the clip, in s/ms. | — |
trim_end |
time / s/ms | Absolute source time at the end of the clip, in s/ms. | — |
loop |
bool | Loop the trimmed source interval. | — |
volume |
number | Playback volume from 0 to 1; defaults to 1. | — |
muted |
bool | Mute the track while retaining video frames. | — |
export_start |
time / s/ms | Explicit page-local MP4 start time for click-triggered video, in s/ms. | — |
Minimal complete example#
p = canvas(size=(100mm,65mm),background="#f4f5f7")v = p.add(video(src="demo.mp4"),size=(80mm,45mm),offset=(10mm,5mm))p.add(text("Step starts video + sound",font_size=4mm),offset=(10mm,55mm))s = p.step(duration=3s,hold=0s)s.play(v,delay=250ms,trim_start=500ms,trim_end=2500ms)s.play(audio(src="music.wav"),delay=250ms,volume=0.2)Concepts and common errors · Composition source
document.play#
Bind page, step or document playback using an independent media clock.
Returns: none
Positional parameters: target.
Required: target.
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
target |
audio | Audio material that continues across pages | — |
trigger |
"auto" | Start automatically with the page/step, or independently on a video click.auto: Start with the page, step or document |
— |
delay |
time / s/ms | Delay after the start condition is met, in s/ms. | — |
trim_start |
time / s/ms | Absolute source time at the start of the clip, in s/ms. | — |
trim_end |
time / s/ms | Absolute source time at the end of the clip, in s/ms. | — |
loop |
bool | Loop the trimmed source interval. | — |
volume |
number | Playback volume from 0 to 1; defaults to 1. | — |
muted |
bool | Mute the track while retaining video frames. | — |
export_start |
time / s/ms | Explicit page-local MP4 start time for click-triggered video, in s/ms. | — |
Minimal complete example#
d=document(name="Media experiment")d.play(audio(src="music.wav"),loop=true,volume=0.15)d.add(page(src="first.lay"))d.add(page(src="second.lay"))Concepts and common errors · Composition source
reflection#
Create a fading mirrored reflection of the visible subject.
Returns: reflection
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
distance |
length / canvas unit | Gap below the subject | 1mm |
length |
value | Reflected fraction of subject height, 0–1 | 0.5 |
opacity |
value | Starting opacity, 0–1 | 0.4 |
fade |
value | Fade amount, 0–1 | 1 |
blur |
length / canvas unit | Gaussian blur standard deviation | 0mm |
target |
"content" | "object" | Effect targetcontent: contentobject: object |
content |
Minimal complete example#
p=canvas(size=(70mm,60mm),background="#ffffff")p.add(rect(size=(30mm,16mm),fill="#3c91b5",effects=[reflection(distance=2mm,length=0.7,opacity=0.5,fade=1,blur=0.3mm)]),offset=(15mm,10mm))Concepts and common errors · Composition source
soft_edge#
Soften the visible silhouette
Returns: soft_edge
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
radius |
length / canvas unit | Inward softening width | 1mm |
target |
"content" | "object" | Effect targetcontent: contentobject: object |
content |
Minimal complete example#
p=canvas(size=(70mm,60mm),background="#ffffff")p.add(ellipse(size=(32mm,25mm),fill="#a665ab",effects=[soft_edge(radius=2mm),shadow(blur=1mm)]),offset=(16mm,12mm))Concepts and common errors · Composition source
three_d#
Object-level 3D appearance
Returns: three_d
| Parameter | Allowed type / unit | Meaning and choices | Default / inheritance |
|---|---|---|---|
depth |
length / canvas unit | Total thickness centered on the object plane | 2mm |
rotation |
(angle,angle,angle) | Rotate around the center in X, Y, Z order | (0deg,0deg,0deg) |
bevel_top |
(length,length) / canvas unit | Front bevel width and height | (0mm,0mm) |
bevel_bottom |
(length,length) / canvas unit | Back bevel width and height | (0mm,0mm) |
projection |
"orthographic" | "perspective" | Projectionorthographic: orthographicperspective: perspective |
orthographic |
distance |
length / canvas unit | Perspective camera distance from the object center | 500mm |
material |
"flat" | "matte" | "plastic" | "metal" | Surface materialflat: flatmatte: matteplastic: plasticmetal: metal |
matte |
light_direction |
(number,number,number) | Direction toward light; right, down, toward viewer are positive | (-1,-1,2) |
light_color |
color | Light color | #ffffff |
intensity |
value | Nonnegative light intensity | 1 |
ambient |
value | Ambient intensity, 0–1 | 0.25 |
Minimal complete example#
p=canvas(size=(70mm,60mm),background="#ffffff")p.add(rect(size=(30mm,20mm),fill="#dcad66",three_d=three_d(depth=5mm,rotation=(20deg,-30deg,0deg),bevel_top=(2mm,1mm),bevel_bottom=(1mm,0.5mm),material="metal"),effects=[soft_edge(radius=0.15mm),reflection(distance=1mm,length=0.6)]),offset=(18mm,12mm))Concepts and common errors · Composition source
css-properties#
CSS property support is shared by the compiler, completion, hover and color editing. Unsupported CSS is recovered with one warning per file. Draft shadow longhands follow the rules in LCSS.
| Property | Type / units | Meaning |
|---|---|---|
font-family |
string | string[] / none | System family, font file path or ordered list. No body fonts are bundled; missing glyphs warn and render as boxes. |
math-font |
string / none | Math font: ratex-katex by default, or an installed font name / file path with an OpenType MATH table. Legacy mathjax-* names warn and map to the default. |
math-text-fallback |
boolean / none | Shape formula text with font_family and text fallback using actual glyph metrics; false checks only math-font coverage. Mathematical symbols retain math_font. |
font-size |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Font size; nonzero CSS lengths require units. Inherits when omitted; em and percentages use the parent font size. |
font-weight |
number | keyword / none | Font weight from 1 to 1000; normal=400, bold/bolder=700 and lighter=300. Relative weight keywords currently use these fixed mappings. |
font-style |
"normal" | "italic" | "oblique" / none | normal, italic or oblique; oblique currently maps to italic. |
color |
color / none | Text color; currentColor lets borders and shadows use the computed color. |
line-height |
length | number / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | An explicit length or unitless font-size multiplier; defaults to 1.2 times font size. |
background |
paint / none | Background paint for the object region, separate from text or lines |
padding |
length | length[] / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Inner spacing; 1–4 CSS lengths follow all, vertical/horizontal, top/horizontal/bottom, or top/right/bottom/left ordering. |
border-radius |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Uniform box corner radius; nonzero lengths need units and percentages use the layout box. Separate corners and elliptical radii are unsupported. |
border-color |
color / none | Closed-outline color; none disables the border |
border-width |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Closed-outline width; nonzero CSS lengths need units. thin/medium/thick mean 1/3/5 layout px. |
border-style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" / none | Border line pattern, independent of fill |
border-dash |
length[] / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Alternating border dash and gap CSS lengths; paired values with units on nonzero lengths. |
border-dash-offset |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Border dash phase; a signed CSS length, with units required for nonzero values. |
border-cap |
"butt" | "round" | "square" / none | Outline dash endpoint shape |
border-join |
"miter" | "round" | "bevel" / none | Outline join |
border-miter-limit |
value / none | Maximum miter extension relative to line width |
border-opacity |
value / none | Independent border opacity, 0–1 |
line-color |
color / none | Open-line color; defaults to series or theme color |
line-width |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Open-line width; nonzero CSS lengths need units. thin/medium/thick mean 1/3/5 layout px. |
line-style |
"none" | "solid" | "dashed" | "dotted" | "dash_dot" | "double" | "triple" / none | Line pattern; double/triple retain transparent gaps |
line-dash |
length[] / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Alternating dash and gap CSS lengths; nonzero lengths require units. |
line-dash-offset |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Line dash phase; a signed CSS length, with units required for nonzero values. |
line-cap |
"butt" | "round" | "square" / none | Open endpoint shape |
line-join |
"miter" | "round" | "bevel" / none | Line segment join |
line-miter-limit |
value / none | Maximum miter extension relative to line width |
line-opacity |
value / none | Independent line opacity, 0–1 |
fill |
paint / none | Interior color, gradient, hatch or image paint; none disables fill. |
opacity |
value / none | Object opacity from 0 to 1; multiplied by ancestor opacity. |
tick-font-size |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Tick-label font size; an explicit CSS length, inheriting font size by default. |
label-font-size |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Axis-label font size; an explicit CSS length, inheriting font size by default. |
tick-color |
color / none | Tick and tick-label color |
grid-color |
color / none | Grid-line color |
grid-line-width |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Grid width; an explicit CSS length, defaulting to 0.3pt. |
grid-line-dash |
value / none | Grid dash and gap lengths; units are required on nonzero CSS lengths. |
start-head |
head / none | Start head configuration; absent by default |
end-head |
head / none | End head configuration; absent by default |
start-cap |
"butt" | "round" | "square" / none | Independent endpoint cap; inherits line_cap |
end-cap |
"butt" | "round" | "square" / none | Independent endpoint cap; inherits line_cap |
text-fill |
paint / none | 字形填充 / Glyph paint; defaults to color |
text-stroke-color |
color / none | 字形描边颜色 / Glyph stroke color |
text-stroke-width |
length / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | 字形描边宽度 / Glyph stroke width |
effects |
effect[] / none | Shadow, glow, reflection and soft-edge effects |
path |
material / none | One open path material with its original curve segments preserved; source endpoints are necks and tips extend outward |
warp |
text_warp / none | 字形变形 / Text warp configuration |
extrude |
text_extrude / none | 二维矢量挤出 / Vector extrusion |
shaft-width |
length | (length,length) | (number,length)[] / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Shaft width: constant, start/end pair, or strictly increasing normalized shaft-arclength stops; piecewise linear interpolation |
heads |
"start" | "end" | "both" / none | Head endpoints; chevrons support one head only |
head-size |
(length,length) / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Head longitudinal length and transverse width; endpoint sizes override head_size |
start-head-size |
(length,length) / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Head longitudinal length and transverse width; endpoint sizes override head_size |
end-head-size |
(length,length) / explicit mm/cm/in/inch/pt/px or CSS relative units; px uses layout_dpi | Head longitudinal length and transverse width; endpoint sizes override head_size |
line |
shorthand / none | Stroke shorthand: width style color |
border |
shorthand / none | Stroke shorthand: width style color |
background-color |
color / none | Background color |
background-image |
paint / none | Gradients, images or patterns ordered front to back |
font |
string / none | Font shorthand: optional style and weight, required size and family, optional /line-height; resets those component properties. |
box-shadow |
"none" / none | Comma-separated box shadows: x/y offset, optional blur/spread/color and inset. First layer is on top; the shorthand resets all shadow components. |
text-shadow |
"none" / none | Glyph shadows |
filter |
"none" / none | A single drop-shadow() |
box-shadow-blur |
length-list / CSS lengths; px uses layout_dpi | CSS Borders 4 working draft: blur radius; preserves existing layers |
box-shadow-spread |
length-list / CSS lengths; px uses layout_dpi | CSS Borders 4 working draft: signed spread |
box-shadow-offset |
offset-list / CSS lengths; px uses layout_dpi | CSS Borders 4 working draft: offsets control shadow layers |
box-shadow-color |
color-list / none | CSS Borders 4 working draft: shadow colors |
box-shadow-position |
"inset" | "outset" / none | CSS Borders 4 working draft: inset/outset |
animation |
motion / none | Shorthand for name, duration, easing, delay, iterations, direction, fill and play state; commas separate animations. |
animation-name |
motion / none | List of @keyframes names; none disables animation. |
animation-duration |
motion / none | Nonnegative duration per iteration in s/ms; default 0s means an effect class alone may not play. |
animation-delay |
motion / none | Delay in s/ms relative to the action start; negative values start partway through. |
animation-timing-function |
motion / none | linear, the ease family, cubic-bezier() or steps(); controls progress between keyframes. |
animation-iteration-count |
motion / none | Nonnegative iteration count, including fractions or infinite; infinite animation needs a finite step window. |
animation-direction |
motion / none | normal, reverse, alternate or alternate-reverse; sets iteration direction. |
animation-fill-mode |
motion / none | none, forwards, backwards or both; controls animated values outside the active interval. |
animation-play-state |
motion / none | running or paused; paused actions need a finite step window. |
transform |
motion / none | Ordered animated transform functions; order matters and static layout anchors stay unchanged. |
transform-origin |
motion / none | Animated transform origin; percentages use the untransformed layout box. |
backface-visibility |
motion / none | visible or hidden; controls the back face during 3D flips. |
visibility |
motion / none | visible or hidden; changes animated visibility without reflow. |
-laymesh-transition |
text / none | GL Transitions effect on entering this page; none switches immediately. |
-laymesh-transition-duration |
text / none | Page transition duration in ms or s. |
-laymesh-transition-timing-function |
text / none | Page transition easing, including cubic-bezier() and steps(). |
background-position |
string / none | Per-layer background position |
background-size |
string / none | Per-layer dimensions including auto/cover/contain |
background-repeat |
string / none | Per-layer tiling: repeat/no-repeat/space/round |
three-d |
three_d / none | Object-level 3D appearance |