/lucid-coder:figure-stylefrom lucid-coder
House figure style for scientific plots in R (ggplot2, ComplexHeatmap) and Python (plotnine, plotnine-extra): use it for ANY figure drawn from experimental, omics or single-cell data, including plot types not listed here (box, violin, slopegraph, forest, volcano, heatmap, dot plot, UMAP, PCA, composition bars, QC, survival curves, enrichment, spatial maps). Takes precedence over generic charting or dashboard skills for these figures. Do NOT fire for web dashboards, slide graphics or UI charts.
Ships in lucid-coder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You draw figures the way this lab does, also for a plot type you have never
been shown. Rules come first as principles, so they carry over to new forms;
the form table after them shows how the principles land on the forms the user
has already judged. Exact values and their sources are the fig.* rows in
${CLAUDE_PLUGIN_ROOT}/skills/lucid-coder/references/house-style.md; the
drawing code is ${CLAUDE_PLUGIN_ROOT}/templates/plots.R and plots.py
(source theme.* and palettes.* first; copy all four into the project).
A colleague reads the figure in a paper or a lab meeting, without the code. They must see what was measured, on how many units, with which test, from the figure and its caption alone. Every choice below serves that reader.
ggpubr::stat_pwc for brackets, patchwork for layout,
and ComplexHeatmap with circlize for annotated heatmaps.from plotnine_extra import *
also gives all of plotnine). Python figures read like their ggplot2 twin,
layer for layer. plotnine-extra supplies the following:
|, /, plot_layout(), plot_annotation();facet_wrap2(), facet_grid2();guide_dendro();guide_axis_scalebar();geom_pointdensity().
Brackets come from plotnine_extra.stat_pwc, the same interface as
ggpubr::stat_pwc:method: Wilcoxon by default, or "t.test";p_adjust_method: for example "BH" or "holm";label="p.adj.format";paired=True with wid="<subject column>";scale_y_continuous(expand=(0.05, 0, 0.15, 0)).
Do not use matplotlib, seaborn or statannotations for a new figure.plotnine and ggplot2 skills hold the API references. Never invent an
argument.Answer these from the data and the analysis before mapping anything to an aesthetic (HadleyViz, biology-core). If one stays unknown, say so in the caption instead of filling it with a common default.
ctrl\n(n = 4).stat_pwc in both languages: ggpubr in R,
plotnine-extra in Python; paired data use the paired test and the subject
column). The test and the adjustment come from
the analysis, never a default, and the caption names both. No stars without
a named test. Error bars or bands name what they are (SD, SE or 95% CI)
and appear only when n supports them. A figure claims no more than the
evidence. An association is never drawn or captioned as a cause, and a
score is never labelled as a probability. A fitted line does not extend
past the data.categorical_palette(labels) (Tol, Okabe-Ito, Tableau Color
Blind, then Tol discrete rainbow up to 23); never tab10/tab20, Brewer
Set1-3, rainbow or jet.expression(log[2]~"fold change") or r"$\log_2$ fold change". Bars start
at 0. Crowded category labels rotate 90°. Embeddings have equal aspect, no
frame and no ticks, with two short corner arrows ("UMAP 1", "UMAP 2"). PCA
axes state the variance explained. Text is at least 6 pt at the final
width. Text on a coloured fill takes text_colour(fill); light series
colours (yellow, sand) switch to black for text. Labels never overlap: repel
with a seed, wrap or rotate; never shrink below 6 pt to fit.outlier.shape = NA under the points. Overlapping densities get
alpha fills. Jitter takes a seed. Too many points to read: rasterise, then
use alpha, then geom_pointdensity(), hexbin or a 2D density. No pie,
radial or dual-axis chart; many categories by group is a dot plot sorted by
value, not grouped bars.ggpubr::theme_pubr(base_size = 8) (Python:
theme_classic(base_size = 8) in theme.py), sizes from FONT_PT; text geoms in pt
(size.unit = "pt"); zoom with coord_cartesian(), never scale limits;
facet strips left, outside, no box; size in mm (89 single column, 183 double);
cairo_pdf plus a PNG for review plus the source-data CSV of the plotted
frame, all through save_panel(). Never a JPEG, never 3D.| Form | How the principles land | Template |
|---|---|---|
| Box, few donors | Points + median, n under labels, bracket with adjusted p, gene as title | plot_box(..., test=, p_adjust=) |
| Paired slopegraph | Lines join each donor, no jitter, bracket with paired test | plot_box(..., pair=) |
| Forest | Point + named interval, dashed line at 0 (or 1 on ratio scales), sorted by estimate, log₂ typeset | same theme, no template |
| Heatmap | Diverging centred at 0, symmetric limits, rotated labels, condition annotation bar, order basis in caption | plot_heatmap(..., col_annotation=), ComplexHeatmap with colorRamp2(c(-L, 0, L)) |
| PCA | Colour and shape by condition, variance on axes, pair lines only when paired | same theme |
| Composition | Stacked proportions 0–100% per sample, label-keyed palette, rotated sample labels; comparing one category across groups is one point per sample per group instead | plot_composition |
| Distributions | Jittered points; median crossbar under 10 per group, box from 10 | plot_box(..., jitter_width=, seed=) |
| Volcano | Blue down, red up, grey rest, dashed cut-offs, top N per direction labelled only when asked | plot_volcano(..., n_label=) |
| Dot plot | Area = fraction expressing with a grey-circle size legend at 25/50/75/100%, viridis mean with a unit colourbar | plot_dotplot(..., mean_label=) |
| UMAP | No frame, corner arrows (R: fixed 10 mm, ARROW_MM; Python: 20% of the data range), label-keyed palette, rasterised points | plot_embedding(..., axis_name="UMAP") |
| Feature on UMAP | viridis, high on top, unit in colourbar | plot_feature |
| Multi-panel figure | Exact mm cells on a 183 or 89 mm page, bold letters a, b, c at 10 pt, one shared legend in its own cell | compose_figure(..., widths_mm=), get_legend() (R only) |
PAGE_MM: 89 mm single column, 183 mm double. In R,
compose_figure(panels, height_mm, widths_mm = c(...)) gives each panel an
exact mm cell; the cells must add up to the page. Pass the same size to
save_panel(), with the panels' data bound by
dplyr::bind_rows(a = d1, b = d2, .id = "panel") as the source CSV.FONT_PT[["large"]]; a legend cell gets no letter.theme(legend.position = "none"))
and add get_legend(one_panel) as its own cell.FONT_PT in theme.*: main 8 pt (axes, legends),
small 6 pt (in-plot labels, the floor), tiny 5 pt (dense secondary text
only), large 10 pt (letters). Never set a text size by hand.|, / and
plot_layout(), at the same page widths and FONT_PT.Run the stop-and-check above first, then work the form out from the data, not from the form's usual look:
Worked examples of that procedure:
Exact ggplot2 calls for rules above (ggplot2 >= 3.5; R Graphics Cookbook 2e, checked against the current API):
geom_text(aes(label = label), data = facet_labels); annotate() repeats in
every facet.theme(legend.position = "inside", legend.position.inside = c(1, 1), legend.justification = c(1, 1)).se * qt(0.975, n - 1) with
n = sum(!is.na(x)), never 1.96.pd <- position_dodge(0.6),
passed to every layer, or they misalign.scale_y_log10(labels = scales::label_log()) + annotation_logticks(sides = "l").cairo_pdf embeds font subsets; do not add extrafont.Critique before redesign (Riffomonas DAIJ): Describe what is drawn and for whom, Analyze the encodings, Interpret what a reader would conclude, Judge whether the figure supports its headline, then propose one alternative. Rebuild from the raw data and check recomputed statistics against the published ones before changing the form.
categorical_palette() keyed by label, or viridis.ylim() or scale_y_continuous(limits = ) to zoom. Do not: it
drops rows before the statistics; use coord_cartesian(ylim = ).The principles generalise the fig.* rows of the house style. The installed
hadley-viz skill gives the stop-and-check, the identities, log axes with
zeros, overplotting, denominators and the clustering rationale. The installed
biology-core skill gives measured versus derived, non-detection versus
absence, scores that are not probabilities, and context in the caption. The
Riffomonas Code Club (Pat Schloss, 2020-2026, reviewed by the user on
2026-10-28) gives no violins, the charts to avoid, coord
limits, pt text, left strips, design-led layout, draw order and LOD sentinels;
theme_pubr is the user's own pick from that review. The
other sources are the immgenT figure site for minimal in-plot text, Wilke's Fundamentals of Data
Visualization and data-to-viz for chart choice, the biology-skills review for
n and order, and the user's picks and notes on the figure gallery
(2026-10-28; all 13 forms picked the house-style reference, with the
refinements above). The bench result that motivated a separate skill: with
only the lucid-coder persona installed, agents loaded Claude Code's generic
dataviz skill for every figure task and never applied the house style.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mdmanurung/lucid-coder --plugin lucid-coder27 skills in this plugin
/alignInstall the lucid-coder house-style configs into this repository, one file at a time, after showing each diff and asking. Use when the user says "align this repo", "install the house style configs", "set up air/ruff/lintr", or "add the palette file"./cccLigand-receptor cell-cell communication between cell types from a log-normalised single-cell h5ad with LIANA+ rank_aggregate (CellPhoneDB, Connectome, log2FC, NATMI, SingleCellSignalR, or a subset), a bundled or exported ligand-receptor resource TSV, a fixed pass rule on magnitude and specificity ranks, a source x target count heatmap, an LR dot plot, a report and a reproducibility bundle. Optional per-sample runs. Fire on "cell-cell communication", "ligand-receptor analysis", "which cell types talk to which", "LIANA", "CellPhoneDB", "rank_aggregate", "CCC between clusters". Do NOT fire for spatial CCC (bivariate, MISTy), for factorising CCC across many samples (Tensor-Cell2cell, MOFAtalk), for DE-driven CCC between conditions, for non-human data without a translated resource, or for raw counts./compositionCell-type composition and differential abundance with crumblr: counts cells per sample and label (from a cell-level h5ad or a counts TSV), drops rare labels, runs crumblr's precision-weighted CLR and variancePartition dream (fixed and random effects, e.g. (1|donor)), and writes tables, a stacked composition bar, per-label proportion boxes, an effect forest, a report and a reproducibility bundle. Fire on "cell-type composition", "differential abundance of cell types", "do cell-type proportions change", "crumblr", "CLR of cell frequencies", "which populations expand after stimulation". Do NOT fire for neighbourhood-level DA on a KNN graph (Milo), gene expression DE (pseudobulk or cell-level), scCODA / Bayesian composition models, or a plain Wilcoxon on frequencies (group-tests).Other plugins' skills for the same job