b2KIT

Contour Map Plotter

Generate contour (level curve) maps for z=f(x,y) with adjustable levels, color fills, and gradient vectors.

Tested tool guide Tested browser tools Checked August 16, 2026

What Contour Map Plotter does, with a checked example

Enter a function z=f(x,y), choose an x-y viewing window, and select the z-values to draw as contours. The plotter can distinguish ranges between contours with color fills and overlay gradient vectors that indicate the direction of increasing function value. Each contour is a level set f(x,y)=c projected onto the x-y plane, not a three-dimensional path. A common mistake is treating filled color bands as additional contour lines. Each band represents values between adjacent selected levels.

Worked example

A concrete input and expected output from the current implementation.

Input

Function: x^2 + y^2
x range: -2 to 2
y range: -2 to 2
Contour level: 1

Expected output

The map contains one closed contour: the unit circle x^2 + y^2 = 1, centered at (0,0). It crosses the axes at (1,0), (-1,0), (0,1), and (0,-1).

A level-1 contour contains exactly the points where the function equals 1. For x^2 + y^2, that equation describes a circle with radius 1.

How the result is produced

1

Level selection

For every requested value c, the plotter draws the x-y locations satisfying f(x,y)=c within the chosen window. Closed contours can surround peaks, valleys, or other regions, while open contours continue to a plot boundary. Changing the level list changes which function values are traced; changing the viewing window can clip or reveal additional branches of the same level set.

2

Fills and gradient vectors

Color fills separate value intervals bounded by the selected contour levels. Gradient vectors represent the local direction in which f increases most rapidly. Where f is differentiable and its gradient is nonzero, those vectors are perpendicular to the level curve through the same point. Arrow direction does not show movement along a contour, since f remains constant along that curve.

Good uses

  • Locate equal-height lines of a modeled terrain function before comparing slopes or basins.
  • Inspect level sets of an objective function when studying minima, maxima, and optimization paths.
  • Compare a scalar field's contour geometry with its gradient directions in multivariable calculus.

Limits and checks

  • A missing contour does not prove the selected level is absent from the displayed window; limited sampling or a feature smaller than the plot resolution can also prevent it from appearing.
  • Closely spaced contours suggest rapid change only when the contour values use equal increments and the x and y axes are interpreted at compatible scales.
  • Discontinuities, undefined regions, sharp features, and boundaries can produce broken curves; a gap should not automatically be interpreted as a peak or valley.

Common questions

Does this show the three-dimensional surface z=f(x,y)?

No. It shows selected function values as curves in the x-y plane. Color fills can communicate value ranges, but they do not provide perspective or surface height. Use a three-dimensional surface plot when you need to inspect overhang-free shape, viewing angle, or apparent vertical relief directly.

Why do the gradient arrows cross the contour lines?

For a differentiable function, the gradient is normal to a smooth level curve wherever the gradient is nonzero. It therefore crosses the contour rather than following it and points toward increasing values. At stationary points the gradient is zero, so no preferred arrow direction exists. This relationship can also fail where the function is not differentiable.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools