{
  "id": "python/matplotlib-figure-too-large",
  "signature": "RuntimeError: In set_size: Could not set the fontsize (or) Image size of 100000x80000 pixels is too large. It must be less than 2^16 in each direction.",
  "signature_zh": "RuntimeError: 图像尺寸 100000x80000 像素过大。每个方向必须小于 2^16。",
  "regex": "RuntimeError:\\ In\\ set_size:\\ Could\\ not\\ set\\ the\\ fontsize\\ \\(or\\)\\ Image\\ size\\ of\\ 100000x80000\\ pixels\\ is\\ too\\ large\\.\\ It\\ must\\ be\\ less\\ than\\ 2\\^16\\ in\\ each\\ direction\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Saving a figure with figsize*dpi exceeding 65535 pixels in either dimension, which exceeds the PNG/JPEG limits enforced by the backend.",
  "root_cause_type": "generic",
  "root_cause_zh": "保存图形时 figsize*dpi 在任一维度超过 65535 像素，超出后端对 PNG/JPEG 的限制。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Higher dpi worsens the pixel count and triggers the same limit.",
      "fail_rate": 0.92,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "'raw' is not a valid format for savefig; the size limit still applies to raster backends.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "fig.set_size_inches(20, 16)\nfig.savefig('out.png', dpi=150)  # 3000x2400 px",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "fig.savefig('out.pdf')  # no pixel limit for vector backends",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}