{
  "id": "python/matplotlib-3d-projection-error",
  "signature": "ValueError: Unknown projection '3d'",
  "signature_zh": "ValueError: 未知投影'3d'",
  "regex": "ValueError:\\ Unknown\\ projection\\ '3d'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Trying to create a 3D subplot without importing mpl_toolkits.mplot3d or using an older matplotlib version where '3d' is not recognized.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试创建3D子图，但未导入mpl_toolkits.mplot3d，或使用了不支持'3d'投影的旧版matplotlib。",
  "versions": [
    {
      "version": "3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Installing mpl_toolkits via pip",
      "why_fails": "mpl_toolkits is part of matplotlib, not a separate package.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using projection='3d' without importing anything",
      "why_fails": "The projection is registered only after importing mpl_toolkits.mplot3d.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Import mpl_toolkits.mplot3d explicitly",
      "success_rate": 0.95,
      "how": "from mpl_toolkits.mplot3d import Axes3D; fig = plt.figure(); ax = fig.add_subplot(111, projection='3d')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the built-in subplot_kw argument",
      "success_rate": 0.9,
      "how": "fig, ax = plt.subplots(subplot_kw={'projection': '3d'})",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}