Unlisted
Edited
Mar 14, 2024
Importers
15 stars
Insert cell
Insert cell
Insert cell
viewof selection = Plot.plot({marks: [
Plot.dot(data, { fill: "2", r: 2.5, stroke: "black", strokeWidth: 0.5 }),
Plot.brush(data, { selection: [[-2, 2], [0, 0]] })
]})
Insert cell
selection
Insert cell
Plot.plot({marks: [
Plot.dot(selection, {fill: "2", stroke: selection.length < data.length ? "none" : "black", strokeWidth: 0.5, r: 3})
]})
Insert cell
Plot.plot({
color: { scheme: "pubu" },
marks: [ Plot.rect(selection, Plot.bin({fill: "count"}, {thresholds: 40})) ]
})
Insert cell
Insert cell
viewof selectionX = Plot.plot({marks: [
Plot.ruleX(data, { x: first, stroke: "pink" }),
Plot.brushX(data, { x: first, selection: [0, 1] })
]})
Insert cell
selectionX
Insert cell
viewof selectionY = Plot.plot({marks: [
Plot.ruleY(data, { y: first, stroke: "orange" }),
Plot.brushY(data, { y: first, selection: [0, 5] })
]})
Insert cell
first = d => d[0]
Insert cell
selectionY
Insert cell
Insert cell
import { data as penguins } from "@observablehq/plot-exploration-penguins";
Insert cell
Insert cell
d3.group(penguins_selection, d => d.island)
Insert cell
Insert cell
Insert cell
d3.group(penguins_selection_ordinal, d => d.island, d => d.species)
Insert cell
Insert cell
Insert cell
Insert cell
selection1
Insert cell
viewof selectionY2 = Plot.plot({
marks: [
Plot.dot(data, { y: first, x: Math.random }),
Plot.brushY(data, { y: first, selection: [0, 5] })
]
})
Insert cell
selectionY2
Insert cell
Insert cell
Insert cell
mutable minibrush = ""
Insert cell
Insert cell
minibrush.values
Insert cell
Insert cell
Plot = require(await FileAttachment("plot@14.umd.js").url())
Insert cell
random = d3.randomNormal()
Insert cell
data = Array.from({length: 500}, () => [random(), random(), random()])
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more