matplotlib/matplotlib · error · ValueError
x and y must be equal-length 1D arrays, but found shapes {se
Error message
x and y must be equal-length 1D arrays, but found shapes {self.x.shape!r} and {self.y.shape!r} What it means
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.
Source
Thrown at lib/matplotlib/tri/_triangulation.py:48
take the *mask* into account, use `get_masked_triangles` instead.
mask : (ntri, 3) array of bool or None
Masked out triangles.
is_delaunay : bool
Whether the Triangulation is a calculated Delaunay
triangulation (where *triangles* was not specified) or not.
Notes
-----
For a Triangulation to be valid it must not have duplicate points,
triangles formed from colinear points, or overlapping triangles.
"""
def __init__(self, x, y, triangles=None, mask=None):
from matplotlib import _qhull
self.x = np.asarray(x, dtype=np.float64)
self.y = np.asarray(y, dtype=np.float64)
if self.x.shape != self.y.shape or self.x.ndim != 1:
raise ValueError("x and y must be equal-length 1D arrays, but "
f"found shapes {self.x.shape!r} and "
f"{self.y.shape!r}")
self.mask = None
self._edges = None
self._neighbors = None
self.is_delaunay = False
if triangles is None:
# No triangulation specified, so use matplotlib._qhull to obtain
# Delaunay triangulation.
self.triangles, self._neighbors = _qhull.delaunay(x, y, sys.flags.verbose)
self.is_delaunay = True
else:
# Triangulation specified. Copy, since we may correct triangle
# orientation.
try:
self.triangles = np.array(triangles, dtype=np.int32, order='C')View on GitHub (pinned to b379c1b69e)
When it happens
Trigger: Thrown at lib/matplotlib/tri/_triangulation.py:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of matplotlib/matplotlib@b379c1b69e (2026-08-21).
Data as JSON: /api/errors/42adf0dc8beda5d4.
Report an issue: GitHub.