observable-plot
Skill49 starsChanged 10 months agoMITView on GitHub
Observable Plot is a JavaScript library for exploratory data visualization. It's built on D3 and provides a concise, declarative API for creating charts. The main function that renders a visualization. Returns an SVG or HTML figure element. Plot expects tabular data as arrays of objects: Map data columns to visual properties: This skill includes detailed documentation for each feature:
- Installs packages
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- address-code-reviewSkill
- autoresearchSkill
- blueskySkill
- brainstormSkill
- code-reviewSkill
- collaborationSkill
- datastarSkill
- decisionsSkill
- design-docSkill
- diarySkill
- gardenSkill
- gitSkill
- gomponentsSkill
- goSkill
- marimoSkill
- nanobananaSkill
- save-web-pageSkill
- sqlSkill
- worktreesSkill
The file
Files
Observable Plot Skill
Observable Plot is a JavaScript library for exploratory data visualization. It's built on D3 and provides a concise, declarative API for creating charts.
Installation
npm install @observablehq/plotOr via CDN:
<script type="module">
import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6/+esm";
</script>Core Concepts
Plot.plot(options)
The main function that renders a visualization. Returns an SVG or HTML figure element.
Plot.plot({
marks: [
Plot.dot(data, {x: "weight", y: "height"})
]
})Key Options
| Option | Description | Default |
width | Outer width in pixels | 640 |
height | Outer height in pixels | auto |
margin | All margins | varies |
marginTop/Right/Bottom/Left | Individual margins | varies |
marks | Array of marks to render | required |
color | Color scale options | auto |
x, y | Position scale options | auto |
title, subtitle | Chart titles | none |
caption | Figure caption | none |
Data Format
Plot expects tabular data as arrays of objects:
const data = [
{date: new Date("2024-01-01"), value: 100, category: "A"},
{date: new Date("2024-01-02"), value: 120, category: "B"}
];Channel Mapping
Map data columns to visual properties:
Plot.dot(data, {
x: "date", // column name
y: "value", // column name
fill: "category", // color by category
r: 5 // constant radius
})Quick Examples
Line Chart
Plot.lineY(data, {x: "date", y: "value"}).plot()Bar Chart
Plot.barY(data, {x: "category", y: "value"}).plot()Scatter Plot
Plot.dot(data, {x: "weight", y: "height", fill: "species"}).plot()Histogram
Plot.rectY(data, Plot.binX({y: "count"}, {x: "value"})).plot()Area Chart
Plot.areaY(data, {x: "date", y: "value", fill: "steelblue"}).plot()Documentation Files
This skill includes detailed documentation for each feature:
Marks (Visual Elements)
marks/area.md- Area charts and stacked areasmarks/bar.md- Bar charts (horizontal and vertical)marks/dot.md- Scatter plots and bubble chartsmarks/line.md- Line chartsmarks/rect.md- Rectangles, histograms, heatmapsmarks/text.md- Text labels and annotationsmarks/rule.md- Reference linesmarks/cell.md- Heatmaps with ordinal dimensionsmarks/tip.md- Interactive tooltipsmarks/axis.md- Custom axesmarks/geo.md- Geographic/map visualizationsmarks/link.md- Connections between pointsmarks/arrow.md- Directed arrowsmarks/vector.md- Vector fieldsmarks/tick.md- Tick marksmarks/box.md- Box plotsmarks/frame.md- Frame decorationmarks/image.md- Image glyphsmarks/contour.md- Contour plotsmarks/density.md- Density estimationmarks/raster.md- Raster/heatmap imagesmarks/hexgrid.md- Hexagonal gridsmarks/waffle.md- Waffle chartsmarks/delaunay.md- Voronoi and Delaunaymarks/bollinger.md- Bollinger bandsmarks/difference.md- Difference chartsmarks/tree.md- Hierarchical treesmarks/auto.md- Automatic mark selectionmarks/linear-regression.md- Trend linesmarks/crosshair.md- Interactive crosshairsmarks/grid.md- Grid lines
Transforms (Data Processing)
transforms/bin.md- Binning for histogramstransforms/group.md- Grouping categorical datatransforms/stack.md- Stacking for area/bar chartstransforms/dodge.md- Beeswarm plotstransforms/hexbin.md- Hexagonal binningtransforms/window.md- Moving averagestransforms/select.md- Selecting specific pointstransforms/normalize.md- Normalizing values
Features
features/scales.md- Scale configurationfeatures/facets.md- Small multiplesfeatures/projections.md- Map projectionsfeatures/legends.md- Legend configurationfeatures/interactions.md- Interactive featuresfeatures/curves.md- Line interpolationfeatures/markers.md- Line markersfeatures/shorthand.md- Concise syntaxfeatures/intervals.md- Time intervals
Common Patterns
Adding a Grid
Plot.plot({
y: {grid: true},
marks: [Plot.line(data, {x: "date", y: "value"})]
})Color Legend
Plot.plot({
color: {legend: true},
marks: [Plot.dot(data, {x: "x", y: "y", fill: "category"})]
})Faceting (Small Multiples)
Plot.plot({
facet: {data, x: "region"},
marks: [Plot.dot(data, {x: "income", y: "lifeExpectancy"})]
})Interactive Tooltips
Plot.plot({
marks: [
Plot.dot(data, {x: "x", y: "y", tip: true})
]
})Stacked Area Chart
Plot.plot({
marks: [
Plot.areaY(data, {x: "date", y: "value", fill: "category"})
]
})Framework Integration
React
import * as Plot from "@observablehq/plot";
import { useRef, useEffect } from "react";
function Chart({ data }) {
const ref = useRef();
useEffect(() => {
const plot = Plot.plot({
marks: [Plot.dot(data, {x: "x", y: "y"})]
});
ref.current.append(plot);
return () => plot.remove();
}, [data]);
return <div ref={ref} />;
}Vanilla JS
const plot = Plot.plot({
marks: [Plot.dot(data, {x: "x", y: "y"})]
});
document.body.append(plot);Resources
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.

