npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

plotagents

v0.10.0

Published

The chart protocol for AI agents: one JSON spec in, a finished accessible SVG out. Bars, lines, Gantt charts, treemaps, sankeys, maps from any GeoJSON/TopoJSON, networks and seaborn-style plots. Zero dependencies.

Readme

plotagents

Beautiful charts from a single JSON spec, built for AI agents.

Documentation, live examples and playground →

Data and field names go in; an accessible SVG comes out, with careful typography, colorblind-safe colors and tooltips. 39 chart types: the ones people reach for in seaborn, sparklines, bump and slope charts, waffles, dot plots and dendrograms, multi-level treemaps and sunbursts, choropleth maps of Chile, the United States and the world, networks, chord diagrams, population pyramids, flow charts and Gantt charts, plus word clouds, a dashboard builder with best-practice layouts, opt-in time controls, small multiples and fully JSON-configurable themes. Zero dependencies. Runs in Node, Deno, Bun and the browser.

npm install plotagents
import { plot } from 'plotagents';

const svg = plot({
  title: 'Biobío accounts for 30% of southern sales',
  subtitle: 'Sales by region, CLP millions, 2025',
  source: 'illustrative data',
  data: [
    { region: 'Biobío', sales: 1240 },
    { region: 'Araucanía', sales: 880 },
    { region: 'Ñuble', sales: 610 },
  ],
  x: 'region',
  y: 'sales',
  locale: 'en',
});

Columns

The interactive gallery, 61 charts with the code for each one, is also in examples/index.html. Try any spec live in the playground.

Why

Agents are good at data and bad at charts: dual axes, 12-slice pies, titles that say nothing. plotagents takes design decisions out of the agent's hands. The rules come from data-visualization teaching for management (Wilke's Fundamentals of Data Visualization, the Data Viz Catalogue, the Atlas of Economic Complexity) and are written into the code:

  • The title states the finding. lint nudges toward it and describe writes the alt text.
  • One axis. There is no dual axis; index: true rebases series to 100 and facet draws panels on a shared scale.
  • Labels at the end of every line, always. When they collide they are spread apart and joined to their point by a thin leader line; a legend appears only when needed.
  • Every pixel for the data. The y axis sits inside the plot on its gridline; margins and type scale down on phones; treemaps, sunbursts, horizontal bars, heatmaps and KPI tiles size their own height.
  • Color follows the entity. Eight validated colors in a fixed order; "Copper" keeps its color when you filter, drill down or move through periods. One solid color per category.
  • Legend and chart are connected. Hover a legend key to light up its marks, click to pin, shift + click to drop that entry (axes and shares recompute, colors stay put). In treemaps a click zooms the whole plot to the category. The legend goes top by default, or legend: "bottom" | "left" | "right".
  • Tooltips that never cover the title. They sit next to the hovered mark, stay inside the chart, and their header wears the mark's color with white or dark text picked by contrast. Arrow keys walk through the data.
  • Estimates look like estimates. dashed hatches the shapes that are projections or provisional figures (same color, striped fill, dashed outline) and dashedFrom: 2025 turns lines, areas and columns dashed from that point on, over a soft labeled band. The legend says what the hatching means; hovering it lights up just those shapes.
  • Maps you can explore. Click a state or region to zoom to it, Ctrl/⌘ + scroll or pinch to zoom, drag to pan; +/−/reset buttons for the keyboard. Hovering outlines the shape instead of dimming the map, and each color class in the legend lights up its regions. Moving through years, colors glide from one to the next.
  • Networks you can explore. Curved edges in the source node's color, sized nodes and labels that never pile up. Pick the placement with layout (force, circular, radial, concentric, clusters, tree, grid). Click a node and it glides to the center with its connections highlighted; click again or press Esc to go back.
  • Thin marks, quiet grid. 4 px rounded data ends, 2.25 px lines, 2 px surface gaps instead of borders.
  • Locale-aware numbers. Spanish (Chile) by default: 1.234,5, 56,1%, $18.500. locale: 'en' gives 1,234.5.

Chart types

| Purpose | type (aliases) | |---|---| | Compare categories | bar (barplot with confidence intervals), count (countplot) | | Change over time | line (lineplot, ci for a confidence band), area, spark (a sparkline for a table cell), bump (rank over time; slope for first vs last) | | Relationships | scatter, bubble, regplot (lmplot), residplot, jointplot, corr (correlation matrix; clustermap with a dendrogram), pairplot (splom), dendrogram (a tree you already computed, cut into colored groups) | | Profiles | radar (spider) | | Distributions | hist (histplot), kde (kdeplot), ecdf, box (boxplot), violin, strip, swarm (beeswarm), point (pointplot), dotplot (Wilkinson: one named dot per row) | | Part-to-whole | treemap (any depth, with % change over time), sunburst, donut, pie, waffle (a count as squares) | | Maps | choropleth (Chile by region, US by state, world by country, or your own GeoJSON / TopoJSON with markers, layers and framing), symbolmap, pointmap (lat/lon dots over OpenStreetMap or Mapbox tiles) | | Projects | gantt (timeline, roadmap): phases that fold and unfold, progress, milestones, dependencies and a today line | | Networks and flows | network, chord, sankey, flowchart (with swimlanes) | | Populations | pyramid | | Grids | heatmap | | Numbers | kpi | | Exact values | table: an indicator per column (data bars, ▲/▼ changes, cell colors, sparklines, progress against a target, status pills, ✓, range rails), pages of 10, cards on phones, click-to-sort and search in the browser, language recognized from the text; rail draws one table row's rail on its own, for an HTML table you keep | | Text | wordcloud (words sized by frequency, or raw text to count) | | Dashboards | dashboard({ title, kpis, charts, filters }): a whole HTML dashboard with best-practice layout (guide) |

Leave type out and it is inferred: dates → line, two measures → scatter, source/target → sankey, path → treemap, categories → bar. Every option is documented in docs/charts.md.

| | | | |---|---|---| | | | | | | | | | | | | | | | |

Time, panels and drill-down

// One period at a time (the latest). Controls are opt-in: `slider: true` adds
// period buttons (few periods) or a minimal slider (many), with a play button.
plot({ type: 'treemap', data, path: ['sector', 'product'], value: 'value', time: 'year', slider: true });

// Time series: `slider: true` adds a two-handle range in the browser.
render('#chart', { type: 'line', data, x: 'month', y: 'sales', series: 'region', slider: true });

// Small multiples (seaborn's col / col_wrap) with shared scales and colors.
plot({ type: 'area', data, x: 'month', y: 'sales', facet: 'region', columns: 3 });

// Treemaps and sunbursts of any depth; click a group to drill down.
plot({ type: 'sunburst', data, path: ['area', 'unit', 'item'], value: 'amount', focus: ['Teaching'] });

// Log scales with 1-2-5 ticks and no empty decades.
plot({ type: 'line', data, x: 'month', y: 'users', series: 'platform', yScale: 'log' });

One switch for fonts and text size

import { configure } from 'plotagents';

configure({ font: 'Poppins', textScale: 1.5 });   // every chart from now on
plot({ ...spec, textScale: 2 });                  // or per chart: presentation mode
configure(null);                                  // back to defaults

font takes a Google Fonts name (it is loaded for you in the browser and in toHTML()), a CSS stack or { family, import }. textScale multiplies every text size and the layout is recomputed with the real sizes, so labels at ×2 still never overlap. configure() also accepts locale, theme, palette or any other spec option.

Themes are JSON

Everything visual is a JSON object merged over a base theme, so an agent can apply a brand without touching code. See docs/themes.md.

plot({
  ...spec,
  theme: {
    extends: 'papel',              // or 'noche' (dark)
    categorical: 'okabe-ito',      // palette name or a list of colors in fixed order
    surface: '#FFFFFF',
    font: { family: "'Poppins', sans-serif" },
    type: { title: 22, titleWeight: 700 },
    marks: { lineWidth: 3, barRadius: 8, barMax: 44 },
    axes: { inside: false },
  },
});

Register it once and every chart uses it; the default look never changes unless you ask:

registerTheme('acme', { background: '#FFF', text: '#111827', grid: { color: '#EEF0F4', dash: '2 3' }, categorical: 'tab10', font: 'Inter' });
configure({ theme: 'acme' });

Every matplotlib colormap works by name for heatmaps, maps and treemaps by change: colorScale: 'viridis', 'RdBu_r', or your own list of colors (color scales).

validatePalette(colors) checks a custom palette with the same tests the built-in one passed (lightness band, chroma floor, colorblind separation, normal-vision separation), and lint runs it for you.

SVG, not Canvas

plotagents renders SVG. Dense charts (more than 1,500 points) are drawn automatically as one path per color, with a nearest-point tooltip layer, which paints faster than Canvas while keeping vector output, server-side rendering and accessible text. The benchmark and the reasoning are in docs/rendering.md.

| Points | SVG, one node per point | Canvas | plotagents (batched SVG) | |---|---|---|---| | 5,000 | 62 ms | 30 ms | 12 ms | | 20,000 | 671 ms | 100 ms | 38 ms | | 50,000 | 1,468 ms | 357 ms | 123 ms |

API

import { plot, safePlot, lint, describe, render, toHTML, schema, toolDefinition, validatePalette } from 'plotagents';

| Function | Returns | |---|---| | plot(spec) | SVG string. Throws PlotError with a fix hint. | | safePlot(spec) | { ok, svg, description, errors, warnings, suggestions }. Never throws. | | lint(spec) | Review of the spec without drawing: errors and design suggestions. | | describe(spec) | Alt text ("Highest: Biobío with 1,240 (30%)…"). | | render(el, spec) | Browser: tooltips, responsive width, drill-down, and time controls when the spec asks for them. | | toHTML(specs) | A self-contained, interactive HTML page in one file. | | schema / toolDefinition({ flavor }) | JSON Schema of the spec and a tool definition for Claude (anthropic) or OpenAI (openai). | | validatePalette(colors, opts) | { ok, checks }. |

In the browser without a bundler, <script src="dist/plotagents.js"></script> defines window.plotagents. Full types are in index.d.ts and every option in schema.json.

Teach your AI to use it (Agent Skill)

skills/plotagents/SKILL.md tells any AI assistant to make its charts with plotagents, with the essentials built in. It also checks npm for a newer release and reads the latest guide when there is one.

npx skills add carlosnavarreteliz/plotagents

That works for Claude Code, Cursor, Codex and other agents that read skills. By hand, for Claude Code:

mkdir -p ~/.claude/skills/plotagents && curl -sL https://raw.githubusercontent.com/carlosnavarreteliz/plotagents/master/skills/plotagents/SKILL.md -o ~/.claude/skills/plotagents/SKILL.md

In the Claude app, zip the skills/plotagents folder and upload it under Settings → Capabilities → Skills.

As an agent tool

import Anthropic from '@anthropic-ai/sdk';
import { safePlot, toolDefinition } from 'plotagents';

const client = new Anthropic();
const res = await client.messages.create({
  model: process.env.ANTHROPIC_MODEL, // the model you use
  max_tokens: 4096,
  tools: [toolDefinition()],
  messages: [{ role: 'user', content: 'Plot the distribution of service times per clinic: …' }],
});
const call = res.content.find((b) => b.type === 'tool_use');
const { ok, svg, errors, suggestions } = safePlot(call.input);
// If !ok, send `errors` back as the tool_result: every error carries a `fix`.

AGENTS.md is a short guide meant to be pasted into an agent's system prompt.

CLI

npx plotagents spec.json -o chart.svg       # SVG
npx plotagents specs.json -o report.html    # several interactive charts on one page
npx plotagents spec.json --lint             # review and suggestions
npx plotagents --tool                       # tool definition

Built-in palette

| Theme | Surface | Categorical (fixed order) | |---|---|---| | papel | #FCFBF9 | #3A47B8 #D42A5E #E8A33D #1E9C89 #7B5CD6 #B5562E #5BA3E0 #8E9A2F | | noche | #0B0F2B | #6170E0 #E63369 #C4851C #22A892 #9780E8 #D06A3E #499BDA #909D2D |

Both pass the lightness, chroma, colorblind (adjacent ΔE OKLab ≥ 8) and normal-vision (≥ 15) checks. The order is part of the validation. Typeface: Mozilla Text, falling back to system-ui.

Development

npm test                 # tests (node:test)
npm run build            # dist/plotagents.js for the browser
npm run examples         # regenerates examples/svg and examples/index.html
npm run site             # builds the GitHub Pages site into _site/ (docs, gallery, playground)

MIT © Carlos Navarrete