marimo-figures
Skill2 starsChanged 7 months agoApache-2.0View on GitHub
Use when the user wants to build, refine, or "Tufte-check" a figure in a marimo notebook — phrases like "plot this", "make a figure", "visualize these results", "tufte review this plot", or any request to iterate on a chart inside a `.py` marimo notebook. Pairs an author pass with a reviewer subagent that scores the figure against Tufte's principles and returns concrete revisions. Do not invoke for matplotlib/seaborn/plotly work outside marimo or for dashboards.
In this repository5 other files it gives its agents.
- dataset-insightsSkill
- experiment-reportSkill
- experiment-structureSkill
- plan-pi-fleshoutSkill
- podman-runnerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 8 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Before drafting, confirm (ask at most one clarifying question, otherwise infer):
- Very specific: line 39
Create or open figures/<slug>.py as a marimo notebook (uv run marimo edit figures/<slug>.py if starting fresh.
- Distinctive: line 79
No gridlines unless the reader needs to read values off the axis.
- Distinctive: line 81
No 3D, no pie charts, no dual y-axes.
- Distinctive: line 89
Before the reviewer pass, confirm the notebook is actually executable — otherwise the PNG you're shipping may be stale.
- Very specific: line 106
After the PNG exists, spawn the tufte-reviewer agent.
- Distinctive: line 122
Read the reviewer's output.
- Distinctive: line 137
Don't invent data to fill a figure — if the data doesn't support the claim, say so and stop.
- Distinctive: line 139
Don't skip the reviewer pass because the figure "looks fine".
- Very specific: line 141
Don't skip the marimo check + uv run step — a notebook that doesn't run isn't a notebook.
- Very specific: line 143
Don't bundle multiple claims into one figure.
- Very specific: line 145
Don't commit the PNG without the .py notebook next to it — the notebook is the source of truth.
- Distinctive: line 197
When load / transform / render takes more than a couple seconds, pick the lightest tool that solves your case:
- Very specific: line 221
Don't put per-figure dependencies in pyproject.toml — they belong in the PEP 723 block so uv run figures/<slug>.py works from a clean …
- Very specific: line 224
Don't set theme = "dark" for figures exported as PNGs — the saved figure inherits matplotlib rcParams, not the marimo theme.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
marimo-figures
Author a figure inside a marimo notebook, then run a Tufte reviewer subagent over the rendered output before handing back to the user. The aim is: one figure, one claim, defensibly designed.
When to use
- The user asks for a chart/plot/figure and the surrounding workflow is marimo (or no tool has been picked yet and the data fits a notebook).
- The user explicitly requests a "Tufte review" of an existing figure.
- A
figures/directory exists under an experiment laid out byexperiment-structureand a new figure needs to land there.
Skip this skill for quick throwaway plots in a REPL, for dashboards, or when the user explicitly asks for matplotlib/plotly scripts outside a notebook.
Inputs you need
Before drafting, confirm (ask at most one clarifying question, otherwise infer):
- The claim — one sentence. "X is monotonic in Y on the training subset." If the user hasn't stated a claim, the figure is not ready; ask for one.
- The data source — path to a parquet/csv, a run directory under
runs/<id>/, or a dataframe already in scope. - The output path — usually
figures/<slug>.png(+ the.pynotebook next to it). Default slug = kebab-case of the claim.
Author pass
- Create or open
figures/<slug>.pyas a marimo notebook (uv run marimo edit figures/<slug>.pyif starting fresh; otherwise edit the file directly — marimo notebooks are plain Python with@app.celldecorators, so standard Edit/Write tools work). Include PEP 723 metadata at the top for reproducibility:# /// script # requires-python = ">=3.12" # dependencies = ["marimo", "seaborn", "matplotlib", "polars"] # /// - Structure the notebook as independent cells — each cell is a function
whose parameters are other cells' return values (marimo manages
dependencies automatically; do not mutate objects across cells):
- imports (marimo, seaborn, matplotlib, polars/pandas, numpy)
- params — a single
mo.mdor dict cell with the claim, the data path, and any filter thresholds. Surface them so a reader can flip one value and re-run. Usemo.app_meta().mode == "script"to swap the data source when running non-interactively instead of hiding widgets. - load — read the data. Gate slow loads with
@mo.cache(see Expensive notebooks for other options). - transform — shape the dataframe to exactly the columns the plot needs. No plotting here.
- plot — return a single
plt.Figure. Only the final expression in a cell renders; don't nest it. - export —
fig.savefig("figures/<slug>.png", dpi=200, bbox_inches="tight").
- Default to seaborn for figures — it sits on matplotlib with cleaner
defaults for statistical plots. Drop to bare matplotlib only for custom
axes, physical units, or dense scientific conventions (log-log, error
bars, colorbars). Set label/font sizing once with
sns.set_context("notebook", font_scale=1)andsns.set_style("white"). For an interactive figure with box/lasso selection, see Interactive figures. - Design rules (pre-empt common Tufte failures):
- Title = the claim, not "Figure 1".
- Label both axes with units. No
x,y,value. - Drop legend when a single short annotation would replace it.
- Pick ≤ 1 encoding per variable (don't map the same thing to color and shape).
- No gridlines unless the reader needs to read values off the axis; then make them faint.
- No 3D, no pie charts, no dual y-axes.
- For categorical x-axes with > 6 levels, sort by the encoded metric.
- Colors: for sequential data use
viridis/magma; for diverging useRdBu; for categorical ≤ 8 usetab10. Never rainbow.
- Render and save the PNG.
Verify the notebook runs (required)
Before the reviewer pass, confirm the notebook is actually executable — otherwise the PNG you're shipping may be stale.
uvx marimo check figures/<slug>.py # lint: dependency / reactivity issues
uv run figures/<slug>.py # script-mode execute end-to-endBoth must pass. marimo check catches missing dependencies and bad
cell graphs; uv run executes the notebook in script mode and will
re-emit the PNG. If uv run succeeds but the PNG didn't update, the
export cell isn't wired into the dependency graph — fix that before
shipping. See Expensive notebooks below if
execution is too slow to run end-to-end on every iteration.
Reviewer pass (required)
After the PNG exists, spawn the tufte-reviewer agent. It owns the rubric
(8 dimensions, 1–5 each, ship bar ≥ 32/40 with no dimension below 3) and
returns scores plus up to 5 revisions as diff hints.
Agent(
subagent_type="tufte-reviewer",
description="Tufte review of <slug>",
prompt="""
Figure: figures/<slug>.png
Notebook: figures/<slug>.py
Claim: <claim>
"""
)Read the reviewer's output. If it meets the ship bar, ship. Otherwise apply the revisions and re-run the reviewer (max 2 revision rounds — after that, surface the disagreement to the user rather than iterating silently).
Output
Report to the user:
- Path to the PNG and the notebook.
- The claim (as rendered in the title).
- Final rubric scores per dimension.
- Any rubric item that stayed below 4, with one sentence on why (often a data-availability issue the user needs to resolve).
What not to do
- Don't invent data to fill a figure — if the data doesn't support the claim, say so and stop.
- Don't skip the reviewer pass because the figure "looks fine". The whole point of this skill is the second opinion.
- Don't skip the
marimo check+uv runstep — a notebook that doesn't run isn't a notebook. - Don't bundle multiple claims into one figure. If the reviewer flags
"two claims", split into
figures/<slug>-a.pyand<slug>-b.py. - Don't commit the PNG without the
.pynotebook next to it — the notebook is the source of truth.
UI elements
marimo has a rich set of UI components. The ones most useful for figure-authoring are listed below. For anything else, query the live docstring:
uv run --with marimo python -c "import marimo as mo; help(mo.ui.slider)"Interactive figures (preferred)
Wrap the axes with mo.ui.matplotlib for box (drag) / lasso
(Shift+drag) selection. The figure renders as a static image with a
selection overlay; the selection is available downstream as
chart.value.
fig, ax = plt.subplots()
sns.scatterplot(data=df, x="x", y="y", ax=ax)
chart = mo.ui.matplotlib(ax)
chartmask = chart.value.get_mask(df["x"], df["y"])
selected = df[mask]Reach for plotly only if you need hover tooltips or 3D.
Other widgets
Names + use cases below. Run help(mo.ui.X) for signatures.
slider/range_slider— drive a numeric param or filter range.dropdown— pick a column or category.checkbox— toggle a layer (e.g. error bars).run_button— gate an expensive re-render; pair withmo.stop(not run_btn.value).date/number— exact inputs where a slider is too coarse.table— surface the underlying rows.tabs— stack alternative views of the same claim (raw / smoothed / residuals)..batch().form()on anmo.mdtemplate — collect several inputs and re-render only on submit; useful when each change is itself expensive.
Expensive notebooks
When load / transform / render takes more than a couple seconds, pick the lightest tool that solves your case:
mo.stop(cond, msg)— halt a cell when a precondition isn't met.mo.ui.run_button+mo.stop(not btn.value)— gate an expensive render on an explicit click so slider tweaks don't trigger work mid-edit.@mo.cache— in-memory memoization for the kernel session.@mo.persistent_cache— disk cache across restarts; use for slow stable loads (large joins, model inference).mo.lazy(thunk)— defer rendering until a tab is selected or a table scrolls into view.
For notebooks that should never autorun, set
[tool.marimo.runtime] on_cell_change = "lazy" in pyproject.toml.
Configuration
The PEP 723 block in Author pass step 1 is the only
config that travels with the figure. For repo-wide defaults
([tool.marimo.runtime] on_cell_change, [tool.marimo.display]
default_width, etc.), run marimo config describe for the full key
list and marimo config show to see what's currently active.
- Don't put per-figure dependencies in
pyproject.toml— they belong in the PEP 723 block souv run figures/<slug>.pyworks from a clean checkout. - Don't set
theme = "dark"for figures exported as PNGs — the saved figure inherits matplotlib rcParams, not the marimo theme.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

