# ValueError: 'viridis'不是有效的颜色映射名称。有效名称包括：['Accent', 'Accent_r', 'Blues', ...]

- **ID:** `python/matplotlib-cmap-name-error`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

颜色映射名称拼写错误（例如'viridis'拼写为'viridiss'）或使用了不存在的名称，导致无法找到匹配的颜色映射。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## 解决方案

1. **Use the correct spelling from the list of valid colormaps** (95% 成功率)
   ```
   plt.imshow(data, cmap='viridis')
   ```
2. **List all available colormaps to find the correct one** (90% 成功率)
   ```
   from matplotlib import cm; print([m for m in cm._cmap_registry.keys()])
   ```

## 无效尝试

- **Assuming case insensitivity and trying 'Viridis'** — Colormap names are case-sensitive; 'Viridis' is not valid, only 'viridis' works. (80% 失败率)
- **Using a numeric index like 0 for the first colormap** — Colormaps are accessed by name, not numeric index. (90% 失败率)
