{
  "id": "python/matplotlib-3d-scatter-size-error",
  "signature": "ValueError: s must be a scalar or 1D array of the same length as x and y, got array of length 5 when x has length 10.",
  "signature_zh": "ValueError: s必须是标量或与x和y长度相同的1D数组，但得到了长度为5的数组，而x长度为10。",
  "regex": "ValueError:\\ s\\ must\\ be\\ a\\ scalar\\ or\\ 1D\\ array\\ of\\ the\\ same\\ length\\ as\\ x\\ and\\ y,\\ got\\ array\\ of\\ length\\ 5\\ when\\ x\\ has\\ length\\ 10\\.",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "In 3D scatter plot, the size parameter 's' must match the number of points; providing a mismatched array causes this error.",
  "root_cause_type": "generic",
  "root_cause_zh": "在3D散点图中，大小参数's'必须与点的数量匹配；提供不匹配的数组会导致此错误。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using a 2D array for s",
      "why_fails": "s must be 1D; 2D arrays are not accepted.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Repeating the same size for all points by using a scalar",
      "why_fails": "This works but does not achieve per-point sizing.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure s array has the same length as x",
      "success_rate": 0.95,
      "how": "ax.scatter(x, y, z, s=np.random.rand(len(x))*100)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a scalar for uniform size",
      "success_rate": 0.9,
      "how": "ax.scatter(x, y, z, s=50)",
      "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-07-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}