Command Palette

Search for a command to run...

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

plot-styling

БесплатноЗапускает вложенные скриптыНе проверен

This skill should be used when the user asks to "plot data", "make a plot for a paper", "make a publication plot", "create a journal-quality plot"…

neuromechanistот neuromechanist★ 61 звезда на GitHub37 установок в других каталогах

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

Plot Styling

Choose the right Python plotting library for the chart type, then apply journal-quality defaults so the panel that comes out of savefig is ready for the figures:scientific-figure composer — no manual cleanup, no font-size firefighting, no chart junk.

Two questions, two minutes

  1. What chart type am I drawing? That answer picks the library (references/library-decision-tree.md).
  2. Which journal am I targeting? That answer picks the style sheet and font minimum (references/sciplots-recipes.md).

Run those choices through the export conventions below and the output SVG should pass figure-qa's plot-script branch and feed scientific-figure without scale-down surprises.

Library decision tree (summary)

Chart type Library Why
Line / scatter / bar with custom layout matplotlib Most control; the lingua franca. Pair with SciencePlots styles to fix defaults.
Statistical (box, violin, regression, faceted) seaborn Better defaults than matplotlib; less code for the common cases. Built on top of matplotlib so the SciencePlots style still applies.
Grammar-of-graphics / R-style faceting plotnine Same geom_* API as ggplot2 without the rpy2 bridge.
Interactive HTML supplement (deck / dashboard) plotly Use plotly for the interactive companion; ship a matplotlib version for print.
3D / volumetric / mesh PyVista (when interactive matters) or matplotlib 3d (for static print) matplotlib 3d is acceptable for simple panels; PyVista when the figure is the interaction.
Already in matplotlib, output looks ugly stay matplotlib + SciencePlots plt.style.use(['science', 'nature']) fixes 80% of "ugly defaults" complaints without rewriting.

Full decision tree with concrete code snippets per branch: references/library-decision-tree.md.

Journal-quality defaults (matplotlib / seaborn)

The cleanest path is to install SciencePlots and apply its style sheet at the top of every plot script. The relevant style names:

  • science — base style (sans-serif, no chart junk, tight margins)
  • nature — Nature column dimensions and font sizing
  • ieee — IEEE narrow-column with grayscale-safe palette
  • vibrant / bright / high-contrast — colorblind-safe palettes from Paul Tol
  • notebook — slightly larger fonts for screen reading (avoid for paper)
import matplotlib.pyplot as plt
import scienceplots  # noqa: F401  (registers the styles)

plt.style.use(["science", "nature", "no-latex"])

no-latex is non-optional unless you have system LaTeX installed AND want path-rendered text (in which case validate_fonts.py cannot inspect font sizes — see the "no-latex" note in references/sciplots-recipes.md).

For a Nature panel at 1-column width with three lines:

import numpy as np
import matplotlib.pyplot as plt
import scienceplots  # noqa: F401

plt.style.use(["science", "nature", "no-latex"])

fig, ax = plt.subplots(figsize=(3.5, 2.5))  # 89 mm x ~63 mm
t = np.linspace(0, 1, 200)
for k, label in enumerate(("control", "drug A", "drug B")):
    ax.plot(t, np.sin(2 * np.pi * (k + 1) * t), label=label, linewidth=1.0)
ax.set_xlabel("time (s)")
ax.set_ylabel("amplitude (a.u.)")
ax.legend(frameon=False, loc="upper right")
fig.savefig("panel_a.svg", bbox_inches="tight", transparent=True)

That single style declaration sets sans-serif fonts at journal-appropriate sizes (Nature 5–7 pt range), removes the right and top spines, applies tight margin defaults, and picks a colorblind-safe palette. See references/sciplots-recipes.md for IEEE, Science, and APS variants.

Export conventions

Every plot panel that will be composed by figures:scientific-figure should:

  1. Save as SVG. savefig("panel.svg", ...). SVG preserves text as <text> so validate_fonts.py can inspect every label.
  2. Use transparent=True. The composer expects panels with transparent backgrounds so they composite cleanly onto the figure canvas. figure-qa's plot-script branch flags transparent=False and missing-transparent as issues.
  3. Use bbox_inches='tight'. Trim whitespace at save time so the panel's bounding box matches its visual extent. The composer's add_panel(..., scale=...) math assumes this.
  4. Embed text, not paths. Default matplotlib SVG output embeds text. If you ever set svg.fonttype = 'path', font validation breaks because there are no <text> elements to inspect.
  5. Size the figure in inches to match the final mm panel size. A Nature 1-column panel is 89 mm = ~3.5 in. figsize=(3.5, ...) produces a panel that the composer can place at scale 1.0 with no font-size shrinkage.

The figure-qa plot-script branch (check_plot_script.py) checks all of these statically from the script's AST. It reports savefig_not_transparent, savefig_missing_bbox_inches, and any rcparam_font_sizes below the journal minimum. See

Полный SKILL.md на GitHub

Установить plot-styling в Claude Code и Claude Desktop

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

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

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

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

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

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

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

examples/.gitignoreexamples/matplotlib-element.pyexamples/sciplots_panel.pyreferences/element-plots.mdreferences/library-decision-tree.mdreferences/sciplots-recipes.md

FAQ

Что делает скилл plot-styling?

This skill should be used when the user asks to "plot data", "make a plot for a paper", "make a publication plot", "create a journal-quality plot", "matplotlib for a figure", "use seaborn", "use plotnine", "use ggplot in Python", "improve plot quality", "style my plot", "clean up my figure", "my matplotlib plot looks ugly", "apply journal style to existing script", "fix matplotlib defaults", "use SciencePlots", "make a Nature-style plot", "make an IEEE-style plot", "make a paper-ready chart", "which plotting library should I use", or wants guidance on choosing between matplotlib / seaborn / plotnine / plotly / pyvista and applying journal-quality defaults. Produces SVG-output Python scripts whose panels are consumed by the scientific-figure composer.

Как установить скилл plot-styling?

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

Скилл plot-styling запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

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

Сравнить plot-styling с