Make and check bar, line, histogram or scatter charts (plotly_chart.py, matplotlib): backing table printed, sorted, labelled, bars from zero. Not for dashboards; use streamlit-app.
Ships in data-analytics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A chart is a drawn table, static (matplotlib PNG) or interactive (Plotly HTML). Print and reconcile the backing table
before saving any chart. Dashboard charts belong to streamlit-app.
SUM, distinct count, per-entity total).gateway(op="call", capability="data", args={op: "stats", path: "<file>", ...}) first: op: "stats" gives types, nulls and earliest/latest dates to catch partial periods, and adding where, group_by and aggregates such as ["sum:Quantity*UnitPrice"] is an exact check on the chart's backing table when complete: true. Build and print the backing table in pandas (all rows up to ~20; otherwise head, tail and total) before plotting.| Question | matplotlib / Plotly | Rule |
|---|---|---|
| Compare categories | barh / px.bar(..., orientation="h") | Sort by value unless naturally ordered (time, tier, rank) |
| Change over time | plot / px.line | One point per complete period; flag any partial edge period |
| Distribution of a measure | hist / px.histogram | Aggregate to the question's grain first (order value is per order, not per line); fixed, left-closed bins |
| Two measures together | scatter / px.scatter | Both at the same grain; report how many points are plotted |
| Share of a whole | sorted bar of percentages | Avoid pie charts with more than three slices |
No dual axes, no 3D and no stacked bars unless showing parts of a whole. Bar axes start at zero. Titles, axis labels and Plotly hover text carry explicit units (currency, orders, %, count). Group items by stable ID/code (attaching the most frequent description only as a label), state any excluded dominant outlier's share in the title/prose, and check active days before calling a partial final period a drop. Use pinned libraries; install nothing without approval.
import matplotlib
matplotlib.use("Agg") # in scripts; omit in notebooks for inline display
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4.5))
table.plot.barh(ax=ax)
ax.set_title("Sales by Sub-Category (all years)")
ax.set_xlabel("Sales (currency)")
ax.set_ylabel("")
fig.tight_layout()
OUT.mkdir(parents=True, exist_ok=True)
fig.savefig(OUT / "sales-by-subcategory.png", dpi=150)
Save PNGs under out/ with short names; in uv run python scripts set Agg before importing pyplot and never call plt.show().
Standalone interactive HTML (include_plotlyjs=True, the default) is the primary Plotly output and needs neither
Kaleido nor Chrome; do not ask to install them unless static PNG export was requested. For any single CSV bar, line,
histogram or scatter chart, run the bundled helper before writing Plotly code. It prints the backing table,
reconciliation and extremes (plus date_range for --time-freq line charts), enforces section 2 rules, writes HTML
under out/, and writes a PNG only when Kaleido (uv sync --extra export) and Chrome/Chromium are both found:
uv run python <base_dir>/scripts/plotly_chart.py --check-env # plotly, kaleido and Chrome availability
uv run python <base_dir>/scripts/plotly_chart.py data/transactions.csv \
--chart bar --x Category --y Amount --agg sum \
--title "Revenue by Category" --x-label "Revenue (currency)" \
--out-html out/revenue_by_category.html
Flags: --chart bar|line|hist|scatter, --y-product Quantity UnitPrice, --group-by "Order ID" (per-entity grain
before hist/scatter), --time-freq MS (line resample), --top N, --keep-order (natural order), --out-png,
--include-plotlyjs cdn (only online when file size matters). A histogram plots --x, or a measure without --x:
--chart hist --y-product Quantity UnitPrice --group-by InvoiceNo gives one value per order. Quote the report's
reconciliation: source_total, plotted_total and difference; with --top also table_total and
top.plotted_share_pct; for hist and scatter bad_source_rows and rows_without_group_key. Write Plotly code
directly when the helper cannot express the chart (computed notebook table, multi-series color=... with legend
toggle, facets, or partial-period annotations); save standalone HTML directly (fig.write_html(OUT / "name.html", include_plotlyjs=True)), or pass --fig-json to the helper when exporting a PNG too:
fig = px.line(monthly, x="Month", y="Revenue", color="Country", markers=True,
title="Monthly net revenue (GBP)", labels={"Revenue": "Net revenue (GBP)"})
fig.add_annotation(x="2011-12", y=dec_val, text="partial month (1-9 Dec)", showarrow=True, ay=-40)
fig.update_yaxes(rangemode="tozero")
fig.write_html(OUT / "monthly_revenue.html", include_plotlyjs=True)
Never write chart JSON to PANCODE_BOARD_FACTS (pancode.board.fact/v1 defines only dataset and experiment; PanCode records PNGs written under out/ automatically).
Interpret with concrete numbers, a comparison and at least one caveat. A chart shows what happened, not why.
What SKILL.md sets; muted values are Claude Code's defaults
/data-analytics:chartsfrom data-analytics
npx claudepluginhub panstudio/pancode --plugin data-analytics9 skills in this plugin
/analysis-projectStart a pinned uv analysis project or check one is ready (check_workspace.py), then lay out its notebook and prompt appendix. Read-only check; syncs only with the user's go. Not for the analysis itself; use pandas-descriptive./customer-analyticsCohort retention, top-customer share and RFM (cohort_table.py, pareto_rfm.py) for repeat and best customers, counting customers and orders, not lines. Not for k-means clusters; use modelling./excelTurn spreadsheet work into Python: VLOOKUP, SUMIFS and pivot tables to pandas, .xlsx read and write, with merged-header, text-number and total traps. Not for Tableau exports; use tableau.Other plugins' skills for the same job