{"record":{"id":"42adf0dc8beda5d4","repo":"matplotlib/matplotlib","slug":"x-and-y-must-be-equal-length-1d-arrays-but-found","errorCode":null,"errorMessage":"x and y must be equal-length 1D arrays, but found shapes {self.x.shape!r} and {self.y.shape!r}","messagePattern":"x and y must be equal-length 1D arrays, but found shapes (.+?) and (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/tri/_triangulation.py","lineNumber":48,"sourceCode":"        take the *mask* into account, use `get_masked_triangles` instead.\n    mask : (ntri, 3) array of bool or None\n        Masked out triangles.\n    is_delaunay : bool\n        Whether the Triangulation is a calculated Delaunay\n        triangulation (where *triangles* was not specified) or not.\n\n    Notes\n    -----\n    For a Triangulation to be valid it must not have duplicate points,\n    triangles formed from colinear points, or overlapping triangles.\n    \"\"\"\n    def __init__(self, x, y, triangles=None, mask=None):\n        from matplotlib import _qhull\n\n        self.x = np.asarray(x, dtype=np.float64)\n        self.y = np.asarray(y, dtype=np.float64)\n        if self.x.shape != self.y.shape or self.x.ndim != 1:\n            raise ValueError(\"x and y must be equal-length 1D arrays, but \"\n                             f\"found shapes {self.x.shape!r} and \"\n                             f\"{self.y.shape!r}\")\n\n        self.mask = None\n        self._edges = None\n        self._neighbors = None\n        self.is_delaunay = False\n\n        if triangles is None:\n            # No triangulation specified, so use matplotlib._qhull to obtain\n            # Delaunay triangulation.\n            self.triangles, self._neighbors = _qhull.delaunay(x, y, sys.flags.verbose)\n            self.is_delaunay = True\n        else:\n            # Triangulation specified. Copy, since we may correct triangle\n            # orientation.\n            try:\n                self.triangles = np.array(triangles, dtype=np.int32, order='C')","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/tri/_triangulation.py#L30-L66","documentation":"Error \"x and y must be equal-length 1D arrays, but found shapes {self.x.shape!r} and {self.y.shape!r}\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/tri/_triangulation.py:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}