{
"title": "contour",
"category": "plotting",
"keywords": [
"contour",
"contour lines",
"iso-lines",
"level sets",
"matlab contour",
"topographic lines"
],
"summary": "Create contour line plots for level sets, iso-lines, and MATLAB `contour` workflows.",
"gpu_support": {
"elementwise": false,
"reduction": false,
"precisions": [
"single",
"double"
],
"broadcasting": "none",
"notes": "`contour` uses the shared contour-generation path and returns a contour handle in the plotting object model."
},
"fusion": {
"elementwise": false,
"reduction": false,
"max_inputs": 3,
"constants": "inline"
},
"requires_feature": null,
"tested": {
"unit": "builtins::plotting::contour::tests"
},
"description": "`contour` creates contour line plots from scalar fields. In RunMat it returns a contour handle, supports MATLAB-style level-list and level-step workflows, and uses the shared contour-generation pipeline. It is the line-oriented member of the contour family, while `contourf` is the filled-region counterpart.",
"behaviors": [
"`contour(Z)` uses implicit axes, while `contour(X, Y, Z)` accepts explicit vector or matrix coordinates.",
"The builtin returns a contour handle that works with the plotting property system.",
"Levels can be controlled through explicit level lists, level counts, or level-step workflows.",
"Contour state is subplot-local and composes naturally with `colormap`, `colorbar`, and surface/composite builtins.",
"GPU-aware contour generation is used when the shared plotting path can operate directly on GPU-resident scalar fields."
],
"options": [
"`'LevelList'` / `'Levels'` accepts an explicit, strictly increasing vector of contour values.",
"`'LevelStep'` specifies evenly spaced contour levels.",
"`'LineColor'` accepts MATLAB color strings, RGB triples, and contour-specific modes such as `'auto'` or `'none'` where supported."
],
"examples": [
{
"description": "Create a contour line plot from a scalar field",
"input": "[X, Y] = meshgrid(-2:0.25:2, -2:0.25:2);\nZ = X .* exp(-X.^2 - Y.^2);\ncontour(X, Y, Z);"
},
{
"description": "Use explicit contour levels",
"input": "[X, Y] = meshgrid(-2:0.25:2, -2:0.25:2);\nZ = X .* exp(-X.^2 - Y.^2);\ncontour(X, Y, Z, [0 0.25 0.5]);"
},
{
"description": "Inspect the returned contour handle",
"input": "[X, Y] = meshgrid(1:20, 1:20);\nZ = X + Y;\nh = contour(X, Y, Z);\nget(h, 'Type')",
"output": "ans =\n 'contour'"
}
],
"links": [
{ "label": "contourf", "url": "./contourf" },
{ "label": "surfc", "url": "./surfc" },
{ "label": "meshc", "url": "./meshc" },
{ "label": "colorbar", "url": "./colorbar" },
{ "label": "colormap", "url": "./colormap" }
],
"source": {
"label": "`crates/runmat-runtime/src/builtins/plotting/ops/contour.rs`",
"url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/plotting/ops/contour.rs"
}
}