xkcd-pylisted
Install: claude install-skill Axect/skills
# xkcd-py — Matplotlib Script Generator (xkcd / hand-drawn style)
Generate a Python plotting script that **always** follows the user's lab
xkcd template. The skill writes a `.py` file and returns its path; it does
not run the script. The user executes it themselves (preferred:
`uv run <path>` per their global preferences).
The canonical template lives at
`~/Socialst/Templates/PyPlot_Template/xkcd_plot.py`. Every variant in this
skill is a structural extension of that file, normalized to the same
`pparam` + ax-object pattern as `scienceplot-py`.
## Mandatory style invariants
Every generated script MUST keep these load-bearing patterns intact. Do not
"clean up" any of them.
1. **xkcd context block** — all plotting (and `savefig`) lives inside
`with plt.xkcd():`. Never substitute `plt.rcParams.update(...)` or call
any plotting outside this block; once the `with` exits, rcParams are
restored and a later `savefig` will lose the xkcd fonts.
2. **`pparam` dict** — axis configuration is a dict, applied with
`ax.set(**pparam)`. Do not inline `ax.set_xlabel(...)`, `set_ylabel(...)`,
`set_title(...)` calls when `pparam` would do.
3. **`ax.autoscale(tight=True)`** — called on every axis, before
`ax.set(**pparam)`. For subplots, loop over all axes.
4. **Raw-string LaTeX** — every label, title, legend entry uses `r'...'`.
xkcd uses matplotlib's `mathtext` for `$...$` blocks (not real LaTeX);
raw strings still matter the moment a backslash appears.
5. **figsize