{
  "id": "python/matplotlib-nonetype-axes",
  "signature": "AttributeError: 'NoneType' object has no attribute 'plot'",
  "signature_zh": "AttributeError: 'NoneType'对象没有属性'plot'",
  "regex": "AttributeError:\\ 'NoneType'\\ object\\ has\\ no\\ attribute\\ 'plot'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Calling ax.plot() on a variable that is None, often because plt.subplots() was called incorrectly or the axes object was not properly extracted.",
  "root_cause_type": "generic",
  "root_cause_zh": "在值为None的变量上调用ax.plot()，通常是因为plt.subplots()调用不正确或未正确提取坐标轴对象。",
  "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": "Checking if the variable name is misspelled",
      "why_fails": "The issue is not a typo but that the function returned None; misspelling would raise NameError.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Reinstalling matplotlib",
      "why_fails": "This is a code logic error, not a library installation issue.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure plt.subplots() returns two values and unpack correctly",
      "success_rate": 0.95,
      "how": "fig, ax = plt.subplots(); ax.plot([1,2,3])",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check if ax is None before plotting",
      "success_rate": 0.9,
      "how": "fig, ax = plt.subplots(); if ax is not None: ax.plot([1,2,3])",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}