Contour Plot Calculator

Visualize loss surfaces, decision boundaries, gradients, hyperparameters, and optimization paths with interactive contours, flexible data tools, detailed statistics, and export-ready results for machine learning.

Results

Ready to calculate.
Minimum Z
Maximum Z
Mean Z
Grid cells
Minimum location
Maximum location
Standard deviation
Missing cells

3D surface comparison

LevelCells ≤ levelSurface shareStatus
Generate a plot to see contour statistics.

Interpretation

Contour lines connect points with equal values. Generate a plot to view a tailored interpretation.

Validation

  • No validation issues.

1. Data source and function

Use math.js syntax. Supported examples include sin(x), cos(y), exp(), sqrt(), abs(), log(), pi, and powers with ^.
First row contains X values. First column contains Y values. Remaining cells contain Z values.
Provide one point per row as x,y,z. An optional fourth column becomes a hover label.

2. Grid, range, and interpolation

3. Data transformations

Set zero to keep all values.

4. Contour levels and display

Comma-separated levels. Each level can be drawn separately.
0.90

5. Titles, axes, and layout

6. Machine learning overlays

7. Gradient-descent simulator

8. Saved settings and export

Formula used

A contour line contains coordinates sharing one function value. It satisfies f(x,y) = c, where c is a selected level.

The numerical gradient is estimated from nearby values. Gradient descent updates both coordinates opposite the local gradient direction.

∇f(x,y) = [∂f/∂x, ∂f/∂y]
x(t+1) = x(t) - η ∂f/∂x
y(t+1) = y(t) - η ∂f/∂y

How to use

  1. Select a function, grid, scattered dataset, or synthetic source.
  2. Choose ranges, resolution, interpolation, and transformations.
  3. Configure contour levels, colours, axes, and optional overlays.
  4. Enable gradient descent to inspect an optimization path.
  5. Generate the chart, review statistics, and export results.

Example data

Use caseXYZInterpretation
Loss landscapeParameter oneParameter twoLossLower contours indicate preferred parameter regions.
Hyperparameter searchLearning rateRegularizationValidation scoreHigher contours indicate stronger model performance.
Decision surfaceFeature oneFeature twoClass probabilityThe 0.5 contour can represent a decision boundary.

Frequently asked questions

What does a contour line show?

It connects points having the same Z value. Closely spaced contours usually indicate rapid change.

Can I use scattered data?

Yes. The calculator interpolates scattered points onto a regular grid before plotting.

Which interpolation method should I choose?

Nearest neighbour preserves local samples. IDW and radial methods create smoother estimated surfaces.

How do contours help machine learning?

They reveal loss minima, parameter interactions, decision boundaries, confidence regions, and hyperparameter performance.

Why are some cells missing?

A function may be undefined there. Masking or outlier removal can also create missing cells.

What is a good grid resolution?

Start near eighty points per axis. Increase resolution carefully for smoother contours.

Can the calculator find a minimum?

It identifies the lowest sampled cell. The optimization simulator can also trace a local descent path.

How is the gradient calculated?

The calculator uses central finite differences where possible. Edge points use one-sided approximations.

Can I export the complete analysis?

Yes. Export images, CSV data, contour levels, JSON settings, copied results, or a PDF report.

Related Calculators

Cost Function CurveGradient Descent Path Plot3D Loss SurfaceLearning-Rate Comparison PlotRegularisation CurveSigmoid Function GraphSoftmax Probability PlotEntropy CurveGini Impurity CurveCross-Entropy Loss Curve

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.