{"record":{"id":"b88d1796e825b006","repo":"plotly/plotly.js","slug":"encountered-arbitrary-coordinates-unable-to-input","errorCode":null,"errorMessage":"Encountered arbitrary coordinates! Unable to input data grid.","messagePattern":"Encountered arbitrary coordinates! Unable to input data grid\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/traces/streamtube/calc.js","lineNumber":206,"sourceCode":"                var q100 = getIndex(i + 1, j, k);\n\n                if(\n                    !(arrK[q000] * dirK < arrK[q001] * dirK) ||\n                    !(arrJ[q000] * dirJ < arrJ[q010] * dirJ) ||\n                    !(arrI[q000] * dirI < arrI[q100] * dirI)\n                ) {\n                    arbitrary = true;\n                }\n\n                if(arbitrary) break;\n            }\n            if(arbitrary) break;\n        }\n        if(arbitrary) break;\n    }\n\n    if(arbitrary) {\n        Lib.warn('Encountered arbitrary coordinates! Unable to input data grid.');\n        empty();\n    }\n\n    return {\n        xMin: xMin,\n        yMin: yMin,\n        zMin: zMin,\n        xMax: xMax,\n        yMax: yMax,\n        zMax: zMax,\n        Xs: Xs,\n        Ys: Ys,\n        Zs: Zs,\n        len: len,\n        fill: gridFill\n    };\n}\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/traces/streamtube/calc.js#L188-L224","documentation":"processGrid in src/traces/streamtube/calc.js:206 validates that x/y/z coordinates form a regular (grid) mesh. When coordinates are 'arbitrary' — not evenly spaced / not a cartesian product along each axis — the streamtube algorithm cannot build the vector-field grid, so Plotly warns and empties the trace (empty()), rendering nothing.","triggerScenarios":"A streamtube trace whose x, y or z arrays are not strictly increasing with uniform spacing, or whose lengths do not correspond to a rectangular grid of u/v/w samples (e.g. scattered measurement points instead of a mesh).","commonSituations":"Feeding raw CFD/experimental sensor data collected at irregular positions; generating coordinates from simulation output on unstructured meshes; typos causing duplicate or out-of-order coordinates.","solutions":["Resample your data onto a regular, monotonically increasing grid before plotting.","Use numpy/meshgrid (or the JS equivalent) to build x/y/z from linspace ranges matching the u/v/w array shapes.","If the data is inherently scattered, visualize with scatter3d instead of streamtube."],"exampleFix":"// before\nx: [0, 0.3, 1], y: [0, 0.7, 1], z: [0, 0.5, 1] // irregular spacing\n// after\nx: [0, 0.5, 1], y: [0, 0.5, 1], z: [0, 0.5, 1] // uniform grid","handlingStrategy":"validation","validationCode":"function isUniformAndIncreasing(arr, eps = 1e-9) {\n  const d = arr[1] - arr[0];\n  if (d <= eps) return false;\n  return arr.every((v, i) => i === 0 || Math.abs((arr[i] - arr[i - 1]) - d) < eps);\n}\nif (!isUniformAndIncreasing(x) || !isUniformAndIncreasing(y) || !isUniformAndIncreasing(z)) {\n  throw new Error('streamtube requires uniformly spaced, increasing x/y/z grids');\n}","typeGuard":"function isRegularGrid(x, y, z) {\n  const inc = a => a.every((v, i) => i === 0 || v > a[i - 1]);\n  return inc(x) && inc(y) && inc(z) &&\n    u.length === x.length * y.length * z.length;\n}","tryCatchPattern":null,"preventionTips":["Always build streamtube coordinates with linspace/meshgrid-style helpers.","Resample irregular measurement data to a regular grid before plotting.","Use scatter3d for scattered data instead of forcing it into streamtube."],"tags":["streamtube","grid-data","coordinate-validation","empty-plot"],"backgroundTag":"non-uniform-grid","analyzedSha":"1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314","analyzedAt":"2026-09-02T22:03:39.906Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}