Observable Plot is the modern default for fast exploratory analysis in a notebook. The handoff from that notebook to a production app, though, is a known rewrite tax: the Plot chart was perfect for thinking, and now it has to be rebuilt as a styled, responsive, accessible component. fromObservablePlot — a sibling to the shippedVega-Lite translator — collapses that tax. It maps a Plot spec to a Semiotic ChartConfig, and the chart arrives carrying everything the throwaway version never had.
Why this matters
A chart sketched in a notebook is built for one reader who can see it and already knows the data. A chart in production is read by people on screen readers, by people on phones, by an agent summarizing the dashboard — none of whom the notebook chart ever considered. The expensive part of the rewrite was never the marks; it was re-acquiring the accessible table, the keyboard navigation, the description, the theme tokens, the SSR path. Semiotic already has all of that. So the adapter's job is narrow and high-leverage: translate the encoding faithfully, and carry the surrounding chart contract into production. The analyst keeps the specification they already use without rebuilding the infrastructure around it.
From a Plot spec to an accessible component
Pick a chart you might have sketched in a notebook. The Plot spec on the left becomes the live, themed, accessible Semiotic chart on the right — same encoding, more capability.
Observable Plot (notebook)
JS
Plot.plot({ marks: [ Plot.lineY(data, { x: "week", y: "users", stroke: "plan" }) ], color: { scheme: "tableau10" } })
Semiotic LineChart (production)
The ChartConfig it compiled to
JSON
{ "component": "LineChart", "props": { "xAccessor": "week", "yAccessor": "users", "lineBy": "plan", "data": "…8 rows", "colorBy": "plan", "colorScheme": "category10" } }
What it gained — a generated description (the notebook chart had none)
A line chart of users by week, split by plan. users ranges from 90 (1) to 360 (4), with a mean of 239.88 across 8 points.
Beyond the description: an accessible data table, keyboard navigation, a focus ring, theme tokens, annotation provenance, and an SSR render path — all from the same config, none of it in the original Plot chart.
Wiring it up
TS
import { unstable_fromObservablePlot } from "semiotic/experimental" import { configToJSX } from "semiotic/ai" // The declarative shape of a Plot spec — { marks, x, y, color, … }, each mark // as { type, data?, options? }. (Plot's API is imperative JS; the adapter reads // this declarative form.) const config = unstable_fromObservablePlot({ marks: [{ type: "lineY", data, options: { x: "month", y: "users", stroke: "plan" } }], color: { scheme: "tableau10" }, }) configToJSX(config) // → "<LineChart data={…} xAccessor=\"month\" yAccessor=\"users\" lineBy=\"plan\" … />"
Strict import and declared losses
Use unstable_fromObservablePlotResult(spec) when accepting a chart from another tool. It returns status, diagnostics, and lossReport; unsupported marks, transforms, facets, layered data marks, scales, and malformed input produce a refused result without a config. Pass { mode: "lossy" }to explicitly accept a translation with the listed losses. The compatibility helper fromObservablePlot keeps its warning and fallback behavior.
CSS paint strings such as steelblue and #f00 become constant colors. Other fill/stroke strings name data fields, and z selects the series before fill or stroke. Both Result importers accept an optional createdAttimestamp for reproducible configurations and return diagnostics without logging warnings.
Where this goes
The notebook→production handoff is one instance of a general pattern: a chart authored in a fast, low-ceremony tool needs to graduate into a context with real readers. The same adapter shape serves a docs site embedding a notebook figure, a BI tool exporting an analyst's exploration, or an agent that drafts in Plot and ships in React. In each case the translation is the cheap part; the capabilities the destination demands are the value.
Related