Manual
Overview
Language
IntroductionScenes & structureText & inlineGraphsCode panesAnimationDataReuse & logicExpressions & parameters
Elements
Text
ParagraphHeading 1Heading 2Heading 3Heading 4Unordered ListDivider
Media
ImageTableEquation
Callouts
NoteDefinitionExampleTask
Graph
GraphLinePolygonCurveIntegralScatterHistogramPointSegmentVectorCircleSquareRectangleTriangleStarDiamondHexagonTextAxis labelAxis BraceFitResidualsContourHeatmapParameter
Code
Code canvasLines
Animation
CueDraw cueTrace cueHighlight cueSpotlight cueType cue
Structure
SceneStep
Reference
Internote Reference
Inline
Formatting
BoldItalicsInline CodeHighlightLink
Text colour
Red textOrange textYellow textGreen textTeal textBlue textPurple textPink textGrey text
Maths
Maths
Reference
Internote ReferenceValueConstant
Other
FootnoteIcon
Directives
DatasetIncludeConstantsTemplatePresetConditionalForIgnore
Keyframes
KeyframeZoom keyframe
Attribute types
?
  1. Elements
  2. Graph
  3. Contour

Contour

contourBlock elementGraph

A two-variable expression drawn as its level sets — the landscape picture a 2D pane can give a surface. The expression is in x AND y (`(x - 2)^2 + (y - 3)^2`), grid-sampled over the visible window and traced where it takes equal values, so panning explores the surface and a parameter in the expression moves the landscape live. `y` is the vertical axis here, not a parameter: only the letters beyond x and y get footer sliders.

Attributes

expressionRequiredImplicit
parametised-surface-expression
Also written: exp, f, func, functionMath expression for the surface's value at (x, y). Free letters beyond x and y are parameters.The head shorthand supplies it: contour:value
levels
parametised-number
How many level sets to draw — resolved to round values of the expression, the way axis ticks are chosen.
Default12
at
parametised-number-list
Also written: values, level-valuesThe exact level values, overriding `levels:` — for the stories even spacing tells wrongly (a quadratic bowl wants 1, 4, 9, 16). Entries are parametised: `at: k, 2 * k, 4 * k` rides a parameter slider.
colour
surface-colour
Also written: colormulticolour (the default) strokes each level along the full spectrum by its own value, violet low to red high; temperature is the blue → white → red ramp; any ordinary hue draws every ring alike. Both ramps are fixed colours, identical in light and dark mode.
Defaultmulticolour
width
number
Stroke width.
Default1.5
opacity
number
How heavy the lines sit over the marks beneath them.
Default1
hidden
boolean
Declared but not drawn — animatable, so `hidden: true !cue.to{false}(at: 2)` is its reveal.
Defaultfalse
lock
boolean
Also written: lockedA reader may not edit it on an editable graph.
Defaultfalse
z
parametised-number
Draw order within the pane.

Derived attributes

Computed while the element renders — read one with #id.name in attribute position or !value:#id.name() in prose, never set.

minDerived
The smallest value the surface takes over the sampled window — for a loss surface, the number the whole picture is about. Cite it with !value:#id.min().
maxDerived
The largest value the surface takes over the sampled window.

Allowed in

canvas.graph { }

Examples

contour(expression: (x - 2)^2 + (y - 3)^2; levels: 8)
contour(expression: x^2 - y^2; at: -4, -1, 0, 1, 4; colour: teal)
contour(expression: (x - a)^2 + (y - b)^2; levels: 10; opacity: 0.7)
contour(expression: x^2 + y^2; at: k, 2 * k, 4 * k, 8 * k)
contour(expression: sin(x) * cos(y); levels: 14; colour: temperature)
On this page
AttributesDerived attributesAllowed inExamples
Contour · Internote