matplotlib/matplotlib · error · ValueError
MultiNorm expects a sequence with one element per component
Error message
MultiNorm expects a sequence with one element per component as input, but got {data!r} instead What it means
Error "MultiNorm expects a sequence with one element per component as input, but got {data!r} instead" thrown in matplotlib/matplotlib.
Source
Thrown at lib/matplotlib/colors.py:3622
Returns
-------
tuple of np.ndarray
"""
if isinstance(data, np.ndarray) and data.dtype.fields is not None:
# structured array
if len(data.dtype.fields) != n_components:
raise ValueError(
"Structured array inputs to MultiNorm must have the same "
"number of fields as components in the MultiNorm. Expected "
f"{n_components}, but got {len(data.dtype.fields)} fields"
)
else:
return tuple(data[field] for field in data.dtype.names)
try:
n_elements = len(data)
except TypeError:
raise ValueError("MultiNorm expects a sequence with one element per "
f"component as input, but got {data!r} instead")
if n_elements != n_components:
if isinstance(data, np.ndarray) and data.shape[-1] == n_components:
if len(data.shape) == 2:
raise ValueError(
f"MultiNorm expects a sequence with one element per component. "
"You can use `data_transposed = data.T` "
"to convert the input data of shape "
f"{data.shape} to a compatible shape {data.shape[::-1]}")
else:
raise ValueError(
f"MultiNorm expects a sequence with one element per component. "
"You can use `data_as_list = [data[..., i] for i in "
"range(data.shape[-1])]` to convert the input data of shape "
f" {data.shape} to a compatible list")
raise ValueError(
"MultiNorm expects a sequence with one element per component. "View on GitHub (pinned to b379c1b69e)
When it happens
Trigger: Thrown at lib/matplotlib/colors.py:3622 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/0a88addbb8a29639.
Report an issue: GitHub.