with one click
figure-formatting
Guide for styling scientific figures with matplotlib.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Guide for styling scientific figures with matplotlib.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Style guidelines for writing manuscript text.
Job dispatch infrastructure. Use when packaging a python script for batch / parallel execution, locally or on SLURM.
Guide for controlling Adobe Illustrator via MCP tools and osascript.
Extract scientific journal article PDFs to lossless Markdown using MinerU. Assumes a pre-existing conda env named "mineru".
Agent roles, models, and the dispatch pattern for delegating to subagents.
Executive role for an agent that dispatches subagents.
| name | figure-formatting |
| description | Guide for styling scientific figures with matplotlib. |
| user-invocable | true |
Style guide for generating publication-ready scientific figures with matplotlib. These conventions match the visual language of the face-rhythm manuscript and should be applied to all new figures.
"Nimbus Sans" as the rendering font (identical metrics), then post-process SVGs to replace with Arial:
svg_text = Path("figure.svg").read_text()
svg_text = svg_text.replace("Nimbus Sans", "Arial")
Path("figure.svg").write_text(svg_text)
frequency (Hz), time (s), (a.u.).Every multi-panel figure must have panel labels. Add them automatically whenever a figure has more than one axes panel.
For simple layouts, ax.transAxes works:
for ax, label in zip(axes, ['A', 'B', 'C']):
ax.text(-0.12, 1.18, label, transform=ax.transAxes,
fontsize=16, fontweight='bold', va='top', ha='left',
fontfamily='Arial')
For complex layouts with nested gridspecs, use figure coordinates after rendering:
fig.canvas.draw()
pos = ax.get_position()
fig.text(pos.x0 - 0.03, pos.y1 + 0.02, "A",
fontsize=16, fontweight='bold', va='top', ha='left',
fontfamily='Arial')
Adjust the following rcParams settings as needed to ensure consistent typography and styling.
from matplotlib import rcParams
rcParams.update({
'font.family': 'Arial',
'svg.fonttype': 'none', ## critical for editable text in Illustrator
'pdf.fonttype': 42, ## TrueType — critical for editable text in PDF/Illustrator
'font.size': 8,
'axes.labelsize': 8,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'axes.titlesize': 8,
'axes.linewidth': 0.75,
'xtick.major.width': 0.75,
'ytick.major.width': 0.75,
'xtick.major.size': 3,
'ytick.major.size': 3,
'xtick.direction': 'out',
'ytick.direction': 'out',
'lines.linewidth': 1.0,
'lines.markersize': 2.5,
'legend.fontsize': 8,
'legend.frameon': False,
})
viridis) unless there is a strong reason not to. Dichromatic colormaps are also good.vmin/vmax). Document if per-panel normalization is used.np.clip(img * 1.8, 0, 255)) for visibility.set_xlim / set_ylim rather than array slicing (preserves coordinate alignment with scatter data).rasterized=True.ax.fill_between(x, mean - std, mean + std, color='C0', alpha=0.3, linewidth=0). Decide between SEM, STD, and CI.s=12, alpha=0.7).bbox_to_anchor with axes-fraction coordinates.gridspec with tight hspace/wspace (0.05-0.15 common).figsize controls the plot area in inches; rcParams text sizes are absolute in points. Changing figsize doesn't change the text size.gs_inner = gs[0, 2].subgridspec(2, 1, height_ratios=[0.7, 0.3], hspace=0.0)
ax = fig.add_subplot(gs_inner[0, 0])
ax_spacer = fig.add_subplot(gs_inner[1, 0]); ax_spacer.axis("off")
ax.set_box_aspect(1.0) (or 0.75 for 25% shorter, etc.).fig.add_axes for custom placements. Just make sure to maintain consistent styling and alignment.Identify scatter plots and image overlays with many (>1k) points. These elements produce thousands of vector paths and make SVGs/PDFs slow to render (watch for SVGs exceeding ~10 MB). Ask the user if they'd like to use rasterized=True on heavy artists to embed them as bitmaps while keeping text and axes as vectors:
ax.imshow(img, rasterized=True)
ax.scatter(x, y, c=colors, rasterized=True)
The dpi argument in savefig controls the resolution of rasterized elements. Use 600 dpi for publication quality.
dpi=600, bbox_inches='tight', pad_inches=0.1, transparent=False). If the figure is very large, prompt the user for guidance on DPI.figures/consistency_curves/barplot_means.latex-pdf-preprocess skill.pdfcrop --margins 2 input.pdf output.pdf (margin in bp, 1bp = 1/72 inch).bnpm.plotting_helpers.Figure_Saver when available:
format_save=['svg', 'png']svg_fontType='none'kwargs_savefig={'dpi': 600, 'bbox_inches': 'tight', 'pad_inches': 0.1, 'transparent': False}