plotly/plotly.js · error

Too many contours, clipping at 1000

Error message

Too many contours, clipping at 1000

What it means

Safety cap in empty_pathinfo (contour/heatmap contour extraction). The code walks contour levels from contoursFinal.start to end in steps of cs, pushing a pathinfo object per level. For pathological settings — extremely small contours.size relative to a large start/end span — this loop would create an unbounded number of levels, so when more than 1000 levels would be generated the loop stops and the excess contours are clipped. This is a warning-style protection, not a data error: the plot still renders with at most 1000 contour levels.

Source

Thrown at src/traces/contour/empty_pathinfo.js:49

    for(var ci = contoursFinal.start; ci < end; ci += cs) {
        pathinfo.push(Lib.extendFlat({
            level: ci,
            // all the cells with nontrivial marching index
            crossings: {},
            // starting points on the edges of the lattice for each contour
            starts: [],
            // all unclosed paths (may have less items than starts,
            // if a path is closed by rounding)
            edgepaths: [],
            // all closed paths
            paths: [],
            z: cd0.z,
            smoothing: cd0.trace.line.smoothing
        }, basePathinfo));

        if(pathinfo.length > 1000) {
            Lib.warn('Too many contours, clipping at 1000', contours);
            break;
        }
    }
    return pathinfo;
};

View on GitHub (pinned to 1d090e0b5f)

Solutions

  1. Increase contours.size (or set contours.showline/type sensibly) so fewer than 1000 levels span the range.
  2. Narrow contours.start/end to the region of interest instead of tiny steps over a wide range.
  3. Use contours coloring 'fill' or 'heatmap' instead of many discrete lines if fine gradations are needed.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/traces/contour/empty_pathinfo.js:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of plotly/plotly.js@1d090e0b5f (2026-09-02). Data as JSON: /api/errors/0b8189202bcc324d. Report an issue: GitHub.