{"record":{"id":"0a88addbb8a29639","repo":"matplotlib/matplotlib","slug":"multinorm-expects-a-sequence-with-one-element-per","errorCode":null,"errorMessage":"MultiNorm expects a sequence with one element per component as input, but got {data!r} instead","messagePattern":"MultiNorm expects a sequence with one element per component as input, but got (.+?) instead","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/colors.py","lineNumber":3622,"sourceCode":"        Returns\n        -------\n        tuple of np.ndarray\n\n        \"\"\"\n        if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n            # structured array\n            if len(data.dtype.fields) != n_components:\n                raise ValueError(\n                    \"Structured array inputs to MultiNorm must have the same \"\n                    \"number of fields as components in the MultiNorm. Expected \"\n                    f\"{n_components}, but got {len(data.dtype.fields)} fields\"\n                    )\n            else:\n                return tuple(data[field] for field in data.dtype.names)\n        try:\n            n_elements = len(data)\n        except TypeError:\n            raise ValueError(\"MultiNorm expects a sequence with one element per \"\n                             f\"component as input, but got {data!r} instead\")\n        if n_elements != n_components:\n            if isinstance(data, np.ndarray) and data.shape[-1] == n_components:\n                if len(data.shape) == 2:\n                    raise ValueError(\n                        f\"MultiNorm expects a sequence with one element per component. \"\n                        \"You can use `data_transposed = data.T` \"\n                        \"to convert the input data of shape \"\n                        f\"{data.shape} to a compatible shape {data.shape[::-1]}\")\n                else:\n                    raise ValueError(\n                        f\"MultiNorm expects a sequence with one element per component. \"\n                        \"You can use `data_as_list = [data[..., i] for i in \"\n                        \"range(data.shape[-1])]` to convert the input data of shape \"\n                        f\" {data.shape} to a compatible list\")\n\n            raise ValueError(\n                \"MultiNorm expects a sequence with one element per component. \"","sourceCodeStart":3604,"sourceCodeEnd":3640,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/colors.py#L3604-L3640","documentation":"Error \"MultiNorm expects a sequence with one element per component as input, but got {data!r} instead\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/colors.py:3622 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"}