Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bio-data-visualization-color-palettes

БесплатноБез исполняемых скриптовНе проверен

Select colormaps and qualitative palettes for scientific figures using perceptual-uniformity, color-vision-deficiency safety, and luminance-monotonicity…

gabrielmoreiraот gabrielmoreira★ 23 звезды на GitHub

Об этом скилле

Version Compatibility

Reference examples tested with: viridis 0.6+, RColorBrewer 1.1+, scico 1.5+ (Crameri colormaps in R), khroma 1.12+ (Tol/Crameri palettes in R), matplotlib 3.8+, colorcet 3.0+, ggsci 3.0+, colorspace 2.1+.

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • R: packageVersion('<pkg>') then ?function_name to verify parameters

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Color Palettes for Scientific Visualization

"Pick a color palette" -> Choose a colormap that (a) is perceptually uniform along the relevant data axis, (b) remains interpretable under common color-vision deficiencies, (c) prints correctly to grayscale, and (d) matches the data type — sequential, diverging, cyclic, or qualitative.

  • R: viridis::viridis, scico::scale_color_scico, khroma::color, RColorBrewer::brewer.pal
  • Python: matplotlib.colormaps, colorcet, seaborn.color_palette, cmcrameri.cm

The Three Modern Standards

  1. Perceptual uniformity -- equal data steps produce equal perceived color steps. viridis (van der Walt 2015), cividis (Nuñez 2018), and the Crameri family (batlow, roma, vik) are designed for this. Jet, rainbow, and red→green are not.

  2. Color vision deficiency safety -- ~6% of males have deuteranopia / protanopia (red-green deficiency). cividis was explicitly designed to be near-identical under normal and CVD viewing (Nuñez 2018 PLOS ONE 13:e0199239). The Okabe-Ito 8-color qualitative palette (popularized in Wong 2011 Nat Methods 8:441) is the CVD-safe categorical default.

  3. Grayscale monotonicity -- a perceptually-uniform sequential colormap has monotonically increasing luminance. Convert the figure to grayscale; if the order is still readable, the colormap is luminance-monotonic. This is the single most actionable test.

Palette Type by Data Type

Data type Use Avoid
Sequential (expression, coverage, density) viridis, magma, cividis, batlow, lipari jet, rainbow, hsv
Diverging (log fold change, z-score, signed correlation) vik, roma, RdBu, BrBG, PiYG jet, rainbow
Cyclic (phase, time-of-day, angle) romaO, vikO, twilight linear sequential (wrap creates artifactual jump)
Categorical (≤8 groups) Okabe-Ito (Wong 2011), Tol bright, Dark2 rainbow with N=20, Set1 if CVD matters
Categorical (9-20 groups) tab20, Paired, Polychrome too-many categorical hues -- consider faceting
Categorical (>20) None -- reconsider design More colors will not help

The Crameri Scientific Colormaps

Crameri 2020 Nat Commun 11:5444 documented the prevalence of misleading palettes (rainbow, red-green) across published science and released a family of perceptually-uniform CVD-safe colormaps via Zenodo (doi:10.5281/zenodo.8409685). Key entries:

Crameri name Type Use case
batlow sequential Default jet replacement; runs through dark-blue → ochre → light-yellow
lipari sequential Higher-saturation alternative; better for projection
vik diverging Blue → white → red equivalent, perceptually uniform
roma diverging Slightly warmer than vik
bam diverging Brown → white → green
romaO cyclic Phase, time-of-day, angle data
vikO cyclic Diverging cyclic
library(scico)
# Sequential
ggplot(df, aes(x, y, fill = value)) + geom_tile() +
    scale_fill_scico(palette = 'batlow')
# Diverging
ggplot(df, aes(x, y, fill = lfc)) + geom_tile() +
    scale_fill_scico(palette = 'vik', midpoint = 0)
from cmcrameri import cm
import matplotlib.pyplot as plt
plt.imshow(data, cmap=cm.batlow)         # sequential
plt.imshow(data, cmap=cm.vik, vmin=-vmax, vmax=vmax)   # diverging, symmetric

viridis Family (matplotlib default since 3.0)

library(viridis)
scale_color_viridis_c(option = 'viridis')   # default: dark blue -> yellow
scale_color_viridis_c(option = 'magma')     # black -> red -> yellow
scale_color_viridis_c(option = 'inferno')   # black -> purple -> yellow
scale_color_viridis_c(option = 'plasma')    # purple -> pink -> yellow
scale_color_viridis_c(option = 'cividis')   # CVD-optimized
scale_color_viridis_c(option = 'turbo')     # jet-like but perceptually uniform
plt.imshow(data, cmap='viridis')   # 'magma', 'inferno', 'plasma', 'cividis', 'turbo'

cividis is the only viridis-family colormap optimized for CVD. Use it for any figure intended to remain interpretable under deuteranopia/protanopia.

Okabe-Ito Categorical Palette (Wong 2011)

The 8-color CVD-safe categorical palette. Memorize the hexes:

okabe_ito <- c(
    '#E69F00',  # orange
    '#56B4E9',  # sky blue
    '#009E73',  # bluish green
    '#F0E442',  # yellow
Полный SKILL.md на GitHub

Установить bio-data-visualization-color-palettes в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/palette_examples.Rexamples/palettes_phd.Rusage-guide.md

FAQ

Что делает скилл bio-data-visualization-color-palettes?

Select colormaps and qualitative palettes for scientific figures using perceptual-uniformity, color-vision-deficiency safety, and luminance-monotonicity criteria. Covers Crameri scientific colormaps, viridis/cividis/magma, Okabe-Ito categorical, ColorBrewer, and the rainbow/jet critique. Use when choosing palettes for heatmaps, scatter, networks, or any encoding where color carries quantitative or categorical meaning.

Как установить скилл bio-data-visualization-color-palettes?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bio-data-visualization-color-palettes запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bio-data-visualization-color-palettes с