observable-plot/SKILL.md
# 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 ```bash npm install @observablehq/plot ``` Or via CDN: ```html <script type="module"> import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/[email protected]/+esm"; </script> ``` ## Core Concepts ### Plot.plot(options) The main function that renders a visualization. Returns an SVG or HTML figure
npx skillsauth add maragudk/skills observable-plotInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Observable Plot is a JavaScript library for exploratory data visualization. It's built on D3 and provides a concise, declarative API for creating charts.
npm install @observablehq/plot
Or via CDN:
<script type="module">
import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/[email protected]/+esm";
</script>
The main function that renders a visualization. Returns an SVG or HTML figure element.
Plot.plot({
marks: [
Plot.dot(data, {x: "weight", y: "height"})
]
})
| 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 |
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"}
];
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
})
Plot.lineY(data, {x: "date", y: "value"}).plot()
Plot.barY(data, {x: "category", y: "value"}).plot()
Plot.dot(data, {x: "weight", y: "height", fill: "species"}).plot()
Plot.rectY(data, Plot.binX({y: "count"}, {x: "value"})).plot()
Plot.areaY(data, {x: "date", y: "value", fill: "steelblue"}).plot()
This skill includes detailed documentation for each feature:
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 linestransforms/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 valuesfeatures/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 intervalsPlot.plot({
y: {grid: true},
marks: [Plot.line(data, {x: "date", y: "value"})]
})
Plot.plot({
color: {legend: true},
marks: [Plot.dot(data, {x: "x", y: "y", fill: "category"})]
})
Plot.plot({
facet: {data, x: "region"},
marks: [Plot.dot(data, {x: "income", y: "lifeExpectancy"})]
})
Plot.plot({
marks: [
Plot.dot(data, {x: "x", y: "y", tip: true})
]
})
Plot.plot({
marks: [
Plot.areaY(data, {x: "date", y: "value", fill: "category"})
]
})
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} />;
}
const plot = Plot.plot({
marks: [Plot.dot(data, {x: "x", y: "y"})]
});
document.body.append(plot);
development
Guide for using git worktrees to parallelize development with coding agents. Use this skill when the user requests to work in a new worktree or wants to work on a separate feature in isolation (e.g., "Work in a new worktree", "Create a worktree for feature X").
development
Guide for working with SQL queries, in particular for SQLite. Use this skill when writing SQL queries, analyzing database schemas, designing migrations, or working with SQLite-related code.
tools
Guide for saving a web page for offline use using the monolith CLI. Use this when instructed to save a web page.
tools
Guide for generating and editing images using generative AI with the nanobanana CLI