plotly/plotly.js · error · Error

Something went wrong with axis scaling

Error message

Something went wrong with axis scaling

What it means

Internal sanity check at the end of setConvert's axis preparation: after computing the linear-to-pixel transform (ax._m slope, ax._b offset, accounting for rangebreaks and log/date scales), the code verifies the transform is finite and the axis length is non-negative. The throw fires when the computed slope/offset are NaN or Infinity (e.g. a degenerate or invalid axis range such as [0, 0], Inf range endpoints, or corrupt rangebreaks), meaning pixel mapping is impossible.

Source

Thrown at src/plots/cartesian/set_convert.js:641

                    ax._B.push(
                        ax._B[ax._B.length - 1] -
                        sign * ax._m2 * (brk.max - brk.min)
                    );
                }

                // fill pixel (i.e. 'p') min/max here,
                // to not have to loop through the _rangebreaks twice during `p2l`
                for(i = 0; i < ax._rangebreaks.length; i++) {
                    brk = ax._rangebreaks[i];
                    brk.pmin = l2p(brk.min);
                    brk.pmax = l2p(brk.max);
                }
            }
        }

        if(!isFinite(ax._m) || !isFinite(ax._b) || ax._length < 0) {
            fullLayout._replotting = false;
            throw new Error('Something went wrong with axis scaling');
        }
    };

    ax.maskBreaks = function(v) {
        var rangebreaksIn = ax.rangebreaks || [];
        var bnds, b0, b1, vb, vDate;


        if(!rangebreaksIn._cachedPatterns) {
            rangebreaksIn._cachedPatterns = rangebreaksIn.map(function(brk) {
                return brk.enabled && brk.bounds ? Lib.simpleMap(brk.bounds, brk.pattern ?
                    cleanNumber :
                    ax.d2c // case of pattern: ''
                ) : null;
            });
        }
        if(!rangebreaksIn._cachedValues) {
            rangebreaksIn._cachedValues = rangebreaksIn.map(function(brk) {

View on GitHub (pinned to 1d090e0b5f)

Solutions

  1. Inspect the axis range in layout (xaxis.range / yaxis.range) for NaN, Infinity, or identical endpoints and fix it.
  2. Check rangebreaks bounds for invalid or reversed values.
  3. Relayout with a valid explicit range, e.g. Plotly.relayout(gd, {'xaxis.range': [0, 10]}).
  4. Report the trace/layout combination as a bug if the range was never set manually.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/plots/cartesian/set_convert.js:641 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/c0553fd5c1f58225. Report an issue: GitHub.