# ValueError: 未知投影 '3d'

- **ID:** `python/matplotlib-3d-proj-not-registered`
- **领域:** python
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在未导入 mpl_toolkits.mplot3d 的情况下使用 add_subplot(projection='3d')，导致投影未注册。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (96% 成功率)
   ```
   import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D  # noqa: F401
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
   ```
2. **** (93% 成功率)
   ```
   import matplotlib.pyplot as plt
ax = plt.axes(projection='3d')
ax.plot3D([0,1,2], [0,1,2], [0,1,2])
   ```

## 无效尝试

- **** — mpl_toolkits ships with matplotlib; installing it separately is unnecessary and may cause version conflicts. (90% 失败率)
- **** — Matplotlib projection names are case-sensitive; '3D' is not registered either. (85% 失败率)
