{
  "id": "python/matplotlib-colorbar-ticks-error",
  "signature": "TypeError: 'ticks' must be a sequence of numbers or None, got <class 'list'> of strings.",
  "signature_zh": "TypeError: 'ticks'必须是数字序列或None，但得到了字符串列表。",
  "regex": "TypeError:\\ 'ticks'\\ must\\ be\\ a\\ sequence\\ of\\ numbers\\ or\\ None,\\ got\\ <class\\ 'list'>\\ of\\ strings\\.",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Passing string labels directly to the ticks parameter of colorbar(), which expects numeric positions.",
  "root_cause_type": "generic",
  "root_cause_zh": "向colorbar()的ticks参数直接传递了字符串标签，但该参数需要数字位置。",
  "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 list of integers but with non-monotonic order",
      "why_fails": "Ticks must be monotonic; non-monotonic values may work but cause visual issues.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting tick labels without setting tick positions",
      "why_fails": "The error is about the ticks argument; positions must be numeric.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set numeric tick positions and then set tick labels separately",
      "success_rate": 0.95,
      "how": "cbar = plt.colorbar(); cbar.set_ticks([0, 0.5, 1]); cbar.set_ticklabels(['low', 'mid', 'high'])",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the format parameter for simple formatting",
      "success_rate": 0.9,
      "how": "cbar = plt.colorbar(ticks=[0, 0.5, 1], format='%.2f')",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}