matlab-plot-skill is a reusable skill for Codex and Claude Code that fixes messy MATLAB figures: cramped layouts, unreadable titles, awkward legends, bad white space, and weak PDF output for LaTeX or Overleaf.
The key rule is simple: the agent must not stop after writing plotting code. It must generate the figure, export it, read the rendered figure itself, and iterate until the visual result is no longer a mess.
- how to make MATLAB figures look professional
- publication-quality MATLAB plots
- fix messy subplot layout in MATLAB
- export MATLAB figure to PDF for LaTeX
- MATLAB figures for Overleaf
- improve MATLAB legend, title, spacing, and white space
- multi-panel MATLAB figures that look cramped or amateurish
- legends that steal too much plot area
- titles that are too long or too small after PDF scaling
- inconsistent colors and symbols across panels
- plots that look acceptable in MATLAB but bad once embedded in a paper
- MATLAB-first figure cleanup for papers, appendices, and slides
- vector PDF export for LaTeX and Overleaf workflows
- better layout choices for multi-panel figures
- explicit render-review-iterate behavior
- reusable MATLAB export helper code
- a quick PNG review path so the agent can read the rendered figure easily
matlab-plot-skill/SKILL.mdmatlab-plot-skill/scripts/export_publication_figure.mmatlab-plot-skill/references/render_review_checklist.mdmatlab-plot-skill/references/matlab_figure_guidelines.mdmatlab-plot-skill/agents/openai.yaml(Codex UI metadata)install.ps1install.shexamples/demo_publication_figure.mexamples/output/demo_publication_figure.png(committed preview image)tools/validate_repo.pyLICENSE,CITATION.cff
- MATLAB R2021a or newer. The export helper uses
exportgraphics(R2020a+) and anargumentsblock (R2019b+); the demo and the documented helper calls use name=value argument syntax (WidthInches=8.4), which requires R2021a+. - For repo validation only:
uv(or Python 3 withpyyaml).
Clone the repo first (the installers run from the clone):
git clone https://github.com/hanlulong/matlab-plot-skill.git
cd matlab-plot-skillInstall into both Codex and Claude Code skill directories:
.\install.ps1Install only into Codex:
.\install.ps1 -Target codexOverwrite an existing installed copy:
.\install.ps1 -Force./install.shInstall only into Claude Code:
./install.sh --target claudeCopy the matlab-plot-skill folder into one or both of these locations:
- Codex:
~/.agents/skills/matlab-plot-skill(Codex releases before 2026 used~/.codex/skills) - Claude Code:
~/.claude/skills/matlab-plot-skill
Use prompts like:
Use $matlab-plot-skill to refactor Plots/generate_my_figure.m into a publication-quality PDF figure. Read the exported figure and the compiled paper page, then iterate until the spacing and titles are clean.
Use $matlab-plot-skill to improve this MATLAB appendix figure. Keep the color mapping fixed across panels, distinguish variants with markers, export a vector PDF, and read the generated figure yourself before stopping.
Run this from the repository root (the path is relative to MATLAB's working directory):
matlab -batch "run('examples/demo_publication_figure.m')"This generates:
examples/output/demo_publication_figure.pdfexamples/output/demo_publication_figure.png
The PNG is there for fast review. The PDF is the publication-style export for the paper workflow. Only the PNG (used as the preview above) is committed; the vector PDF is git-ignored and produced locally when you run the demo.
tools/validate_repo.py is an optional local check (it is not run by CI). Run it before contributing:
uv run --with pyyaml python tools/validate_repo.py .(Or pip install -r requirements-dev.txt first, then python tools/validate_repo.py ..)
This checks:
- required skill packaging files, including the committed demo PNG
SKILL.mdfront matter and that the body still expresses the render-review-iterate workflow- the export helper still uses
exportgraphicsvector output, and the demo still calls that helper - relative markdown links resolve
openai.yamlskill metadata- PowerShell install flow (when PowerShell is available)
- bash install flow (when bash is available)
- If you change the MATLAB code, lint it locally:
matlab -batch "checkcode('matlab-plot-skill/scripts/export_publication_figure.m')"(and the demo). - If you change the demo, re-run it with MATLAB and re-commit
examples/output/demo_publication_figure.png(the committed preview image). - Run the validator above before committing.
- Codex reads
agents/openai.yamlfor optional UI metadata. - Claude Code can use the same
SKILL.md-based folder structure. - The installer copies the skill, so re-run it with
--force(-Forceon PowerShell) after you update the repo to refresh the installed copy. - Restart your Claude Code or Codex session after installing so the new skill is picked up.
