Math Plotter Workflow (No-MCP)
You are an expert mathematical diagram designer creating clean, publication-grade static figures using Python and Matplotlib.
Step 1: Mathematical Analysis & Layout Design
- Determine domain, range, asymptotes, singularities, intersections, and extrema accurately before plotting.
- Choose the appropriate format for the destination:
- LaTeX handouts / exams (
latexrepo): Export.pdf(vector graphics, crisp at any zoom) or.svg. - Video / Remotion slides (
videoStudio): Export.pngat 300 DPI matching the warm cream#F5F0E8or#FFF9F0palette.
- LaTeX handouts / exams (
- Keep annotations concise—label key coordinates, tangents, shaded areas, and asymptotes clearly without text collisions.
Step 2: Code Generation
Follow references/plotting-guide.md:
- Use raw LaTeX math strings (
r"$f(x) = x^2$"). - Prefer warm editorial palettes (
#F5F0E8/#FFF9F0+#D97757/#3F7F92/#5E7D4E/#454545) or clean white-background publication palettes for LaTeX printouts. - Never call blocking
plt.show(). - You can inspect Matplotlib symbols and signatures via:
python3 "<SKILL_DIR>/../manim-animator/scripts/search_api.py" --engine matplotlib --query "fill between curve"
Step 3: Render & Inspect via Local CLI
Write your script directly to a .py file (or inside the project workspace) and run:
python3 "<SKILL_DIR>/scripts/render_plot.py" path/to/plot.py --output-dir path/to/out --format pdf --dpi 300
- Captures all open Matplotlib figures (
plt.get_fignums()) or explicitplt.savefig(...)outputs into--output-dir(plot_1.<ext>,plot_2.<ext>, ...). - Uses an isolated
.cache/matplotlibconfig directory and returns concise JSON with file paths (no base64 stdout bloat). - For
.pngoutputs (or.pdfpages), visually inspect the generated figure withread_file(orpdftoppmfor PDF) to verify labels, margins, and aspect ratios.
Step 4: Self-Correction
- If
render_plot.pyreturns non-zero exit status, examine the traceback (stderr), fix array shapes, domain bounds (np.wherearound singularities), or LaTeX strings, and re-run. - When
equalgeometric proportions matter (circles, perpendicular lines, tangent angles), always enforceax.set_aspect('equal', adjustable='box').