Skip to content
Skills Library
Data & analytics · Building & coding

code-visualization-palette

/code-visualization-palette

精美的可视化调色盘,在数据可视化中使用;若使用tidyplots包,则不必使用本技能。

Licence
MIT
Last repository change
27.10.2026

Assessment and security

96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

精美的可视化调色盘,在数据可视化中使用;若使用tidyplots包,则不必使用本技能。

Original author description

精美的可视化调色盘,在数据可视化中使用;若使用tidyplots包,则不必使用本技能。

How it works

  1. 概述
  2. 强制规则
  3. 图形语义到色板类型的映射
  4. 色板优先级与数量规则
  5. 语言与绘图库适配规则
  6. 参考文件
  7. 输出要求
Original SKILL.md headings · 62 lines, 152 words
SKILL.md preview
---
name: code-visualization-palette
description: 精美的可视化调色盘,在数据可视化中使用;若使用tidyplots包,则不必使用本技能。
---

# 代码可视化配色规范

## 概述

将本技能内置的配色规则应用到所有代码生成的图表、热图和统计图中。覆盖绘图库默认调色板,并为 Python、R 及其他绘图库显式输出 hex 颜色列表或连续色标对象。

## 强制规则

- 用户未明确指定颜色时,必须使用本技能生成的调色板。
- 若使用tidyplots包,则不必使用本技能生成的调色板。


## 图形语义到色板类型的映射

- 分类变量、分组柱状图、分组散点图、分组箱线图和离散图例,使用 `离散性配色`。
- 强度、表达量、密度、概率、单向递增热图等单方向连续变量,使用 `连续性配色-单色系`。
- log2 fold change、相关性、残差、上下调等以中点为参照的双向连续变量,使用 `连续性配色-双色系`。

## 色板优先级与数量规则

### 离散型

- 优先使用 `离散性配色-1`,其次使用 `离散性配色-2`。
- 当 `n <= 6` 时,取 `离散性配色-1` 的前 `n` 个颜色。
- 当 `7 <= n <= 11` 时,先用完整的 `离散性配色-1`,再按顺序补入 `离散性配色-2` 直到达到 `n` 个颜色。
- 当 `n > 11` 时,以 `离散性配色-1 + 离散性配色-2` 组成的 11 个锚点色进行均匀插值。
- 当 `n > 11` 时,必须提醒用户类别过多会降低颜色可辨识性,并建议合并类别、分面展示或增加形状、线型等辅助编码。

### 连续单色型

- 优先使用 `连续性单色-2`,其次为 `连续性单色-4`、`连续性单色-3`、`连续性单色-5`。
- 连续色标直接使用完整且有序的色带。
- 分箱连续图从完整色带中等距抽样出 `n` 个颜色。
- 不要打乱颜色顺序。

### 连续双色型

- 优先使用 `连续性双色-5`,其次为 `连续性双色-1`、`连续性双色-4`、`连续性双色-3`。
- 连续双色色标直接使用完整且有序的色带。
- 对称分箱时按等距方式抽取颜色,并尽量保留中点附近的平滑过渡。
- 除非用户明确要求反转高低值语义,否则不要反转左右方向。

## 语言与绘图库适配规则

- 在 Python 中,离散色板优先输出显式的 `list[str]` hex 列表,连续色标优先使用 `LinearSegmentedColormap.from_list(...)`。
- 在 R 中,离散色板优先输出显式的 `c("#xxxxxx", ...)` 向量,连续色标优先使用 `scale_*_gradientn(colours = ...)` 或等效函数。
- 在 `matplotlib`、`seaborn`、`plotly`、`ggplot2`、`ComplexHeatmap`、`altair`、`vega-lite` 等库中,必须显式传入本技能生成的调色板,不依赖默认主题色。

## 参考文件

- 具体色板、优先级、hex 顺序和数量规则见 [references/palette-rules.md](references/palette-rules.md)。
- Python 绘图示例见 [references/python-visualization-examples.md](references/python-visualization-examples.md)。
- R 绘图示例见 [references/r-visualization-examples.md](references/r-visualization-examples.md)。

## 输出要求

- 说明所选色板类型和具体色板名称。
- 说明需要多少个颜色,以及这些颜色是如何截取、补齐或插值得到的。
- 若离散类别过多并触发插值,应明确说明这一点。
- 除非用户要求展开解释,否则保持说明简洁。
Files in this package (4)
  • SKILL.md 3 KB
  • references/palette-rules.md 5 KB
  • references/python-visualization-examples.md 3 KB
  • references/r-visualization-examples.md 2 KB

Versions

The database has no other skills named code-visualization-palette.

Database snapshot: 13.11.2026 · package version d1e2bfe03810 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100visualization-best-practices
    Manage visualization best practices operations. Auto-activating skill for Data Analytics. Triggers on: visualization best practices, visualization best practices Part of the Data Analytics skill category. Use when working with visualization best practices functionality. Trigger…
  • 90hue-palette
    Design a color palette with semantic tokens for a brand or product. Use when asked to "design a color palette", "what colors should we use", or "define semantic color tokens".
  • 100data-visualization-helper
    Configure with data visualization helper operations. Auto-activating skill for Visual Content. Triggers on: data visualization helper, data visualization helper Part of the Visual Content skill category. Use when working with data visualization helper functionality. Trigger with…
  • 100creating-data-visualizations
    Generate plots, charts, and graphs from data with automatic visualization type selection. Use when requesting "visualization", "plot", "chart", or "graph". Trigger with phrases like 'generate', 'create', or 'scaffold'.
  • 90data-visualization
    Apply data visualization in reproducible local data workflows with version-aware APIs, explicit assumptions, and validation. Use when the user chooses data visualization or its strengths fit the task.
  • 100color-palette-library
    500+ ready-made color palettes with contrast scores, plus OKLCH palette generation, dark-mode luminance mapping, semantic color architecture, and data-viz scales. Use when picking or generating a specific palette. For color theory and hierarchy craft, use ui-visual-design-system.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.