--- name: beautiful-data-viz description: Shared design rules for every plot, figure, chart, dashboard or Dash app (matplotlib, seaborn, ggplot2, Plotly, HTML/SVG). Greyscale first, curated non-stock palettes, IBM Plex Sans, no in-plot titles, crisp text, tight layout. Use when making, restyling or reviewing any chart, figure or dashboard. argument-hint: "[medium=notebook|paper|slides|web] [background=light|dark]" --- # Beautiful Data Viz The owner's standard for any data visual, whatever the library or medium. It overrides the defaults of matplotlib, seaborn, ggplot2, Plotly, and built-in harness visualization skills so figures never look like generic stock or default LLM plots: greyscale first, curated editorial palettes only when color encodes information, **IBM Plex Sans** typography, no in-figure titles, generous readable text, and minimal wasted whitespace. Other skills that draw figures (`/notebooks`, `scientific-illustrations`, the `bio-*` reporting skills) follow these rules and add only what their medium needs. ## Instructions 1. **Greyscale first; never use default or stock LLM palettes.** Draw every mark in neutral greys by default. Add color only when it encodes information: - a category the reader must tell apart, - the one highlighted finding (one accent color; everything else stays grey), - an ordered or signed quantity (sequential or diverging scale). Never use library or stock AI defaults (`tab10`, seaborn default, ggplot2 default hue/rainbow, Plotly default blue/red/green, generic blue-purple gradients). Pick curated palettes from [references/palettes.md](references/palettes.md) (also exported as `PALETTES` in [assets/beautiful_style.py](assets/beautiful_style.py)). Never make color the only encoding (add position, shape, line style, or a direct label), and verify greyscale print legibility. 2. **Use IBM Plex Sans and avoid small text.** Set **IBM Plex Sans** (`"IBM Plex Sans"`, falling back to `"Liberation Sans"`, `"DejaVu Sans"`, `sans-serif`) across every backend instead of default library fonts; bundled TrueType weights ship under `assets/fonts/` and auto-register when `set_beautiful_style()` runs. Size text generously for the final rendered/print width (minimum >= 9 pt in print/paper, >= 11 pt in notebooks, >= 13 pt on slides); never shrink labels into micro-text to cram a crowded panel. 3. **No plot or subplot titles inside the figure.** Do not add figure suptitles, plot titles, or subplot titles inside the artwork—they belong in the figure legend/caption. Identify multi-panel layouts with concise bold panel letters (`A`, `B`, `C`), and let axis labels (with units), direct labels, and the caption below the figure do the explaining (in notebooks, put the figure cell first and the caption below it). 4. **Minimize wasted whitespace.** Use tight margins (`margins(x=0.02, y=0.04)`), compact `constrained_layout=True` padding, tight subplot gaps, and `bbox_inches="tight"` with `pad_inches=0.02`. Avoid dead legend columns or oversized empty canvas margins; prefer direct series labels or a compact legend inside/above the data area. 5. Clarify the message, comparison context, audience, and medium (`notebook`, `paper`, `slides`, `web`). One or two values read better as a sentence; a short lookup list reads better as a table. 6. Choose the simplest chart that answers the question: horizontal bars or dot plots for ranked categories, small multiples instead of more than four overlaid series or a dual axis, slopegraphs for before/after, sparklines for compact trends. 7. Remove chart junk: no 3D, no pie charts unless asked for, no decorative borders, no heavy grids, no gradient fills, no dual y-axes, no top/right spines. 8. Apply the style for the medium: - matplotlib or seaborn: `cfg = set_beautiful_style(medium="paper")` from [assets/beautiful_style.py](assets/beautiful_style.py), imported with the skill directory on `sys.path` (setup in [examples/recipes.md](examples/recipes.md)); it is the single source of IBM Plex Sans typography, curated `PALETTES`, grey series cycle with distinct line styles, tight layout padding, and dpi (150 on screen, 300 on export). `cfg.accent` is the highlight color for the current background. Helpers: `direct_label`, `annotate_point`, `apply_range_frame`, `sparkline`, `finalize_axes`. - R / ggplot2: `theme_classic(base_family = "IBM Plex Sans")` or `theme_minimal(base_family = "IBM Plex Sans")`, `scale_colour_grey()` for neutral series, `scale_colour_manual()` with curated hex codes from [references/palettes.md](references/palettes.md) for encoded categories or the single highlight. - Plotly or Dash: register the IBM Plex Sans greyscale-first template in [references/dash.md](references/dash.md) with compact margins and accent added per trace. - HTML / SVG: set `font-family: "IBM Plex Sans", "Liberation Sans", "DejaVu Sans", sans-serif`, define neutral greys and curated accents as CSS custom properties, and redefine them for dark mode. 9. Check the result at the target size with [references/checklist.md](references/checklist.md), and inspect a greyscale copy (`Image.open(path).convert("L")` with Pillow) to confirm every encoding survives. 10. Reproduce figures from a pinned environment: the project's `pixi.toml` (this skill ships one) or a PEP 723 script run with `uv run --script`, as in [scripts/export_fixture.py](scripts/export_fixture.py). Duplicate figures in an executed Jupyter notebook: see the `/notebooks` troubleshooting section. ## Input Requirements Tabular data, the message the figure must carry, and the target medium, size, and background. ## Output Figures as PNG, SVG, or PDF (or an HTML/SVG visual) and the plotting code that reproduces them. ## Quality Gates - The figure does not look like a default library/LLM stock chart: IBM Plex Sans font (with clean fallback if uninstalled), curated palette or neutral greys, no in-plot/subplot titles, readable text (>= 9 pt at print size), and minimal whitespace. - The message is clear within a few seconds at the target size, and a sentence or table would not do better. - The greyscale copy stays readable; color is never the only encoding. - From the skill directory, `uv run --script scripts/export_fixture.py fixtures/growth_curve.csv --out build/fixture` ([script](scripts/export_fixture.py), [fixture](fixtures/growth_curve.csv)) writes non-empty PNG, SVG, and PDF files with grey default series and no in-plot title; with `--background dark`, labels inherit the dark-theme text color.