Unlisted
Edited
Jun 14, 2023
Paused
1 fork
Importers
6 stars
Insert cell
Insert cell
viewof selection = Plot.plot({
marks: [
Plot.dot(penguins, { x: "culmen_length_mm", y: "culmen_depth_mm" }),
Plot.dot(penguins, Plot.brush({ x: "culmen_length_mm", y: "culmen_depth_mm", fill: "species", stroke:"black" }))
]
})
Insert cell
Inputs.table(selection.length ? selection : Object.assign([], {columns: penguins.columns}))
Insert cell
viewof logical = Plot.plot({
marks: [
Plot.dot(penguins, { x: "culmen_length_mm", y: "culmen_depth_mm" }),
Plot.dot(penguins, Plot.brush({ x: "culmen_length_mm", y: "culmen_depth_mm", fill: "species", stroke:"black", selectionMode: "extent" }))
]
})
Insert cell
logical
Insert cell
Insert cell
viewof facetedSelection = Plot.plot({
facet: {data: penguins, x: "species"},
marks: [
Plot.dot(penguins, { x: "culmen_length_mm", y: "culmen_depth_mm" }),
Plot.dot(penguins, Plot.brush({ x: "culmen_length_mm", y: "culmen_depth_mm", fill: "species", stroke:"black" }))
]
})
Insert cell
facetedSelection
Insert cell
Insert cell
viewof bandSelection = Plot.plot({
marks: [
Plot.cell(penguins, Plot.group({fill: "count"}, { x: "species", y: "sex", fillOpacity: 0.3 })),
Plot.cell(penguins, Plot.brush(Plot.group({fill: "count"}, { x: "species", y: "sex" }))),
]
})
Insert cell
bandSelection
Insert cell
Insert cell
viewof rectSelectionX = Plot.plot({
marks: [
Plot.rectY(
penguins,
Plot.binX({ y: "count" }, { x: "body_mass_g", fillOpacity: 0.5, thresholds: 20 })
),
Plot.rectY(
penguins,
Plot.brushX(Plot.binX({ y: "count" }, { x: "body_mass_g", thresholds: 20 }))
)
]
})
Insert cell
rectSelectionX
Insert cell
viewof rectSelectionXContinuous = Plot.plot({
marks: [
Plot.rectY(
penguins,
Plot.binX(
{ y: "count" },
{ x: "body_mass_g", fillOpacity: 0.5, thresholds: 20 }
)
),
Plot.barX(
d3.sort(penguins, (d) => d.body_mass_g),
{
...Plot.brushX({
x1: "body_mass_g",
x2: Plot.valueof(
d3.sort(penguins, (d) => d.body_mass_g),
"body_mass_g"
).slice(1)
}),
fill: "steelblue",
stroke: () => "steeblue",
mixBlendMode: "color",
}
)
//Plot.dot(penguins, Plot.dodgeY(Plot.brushX({ x: "body_mass_g" })))
]
})
Insert cell
mutable debug = null
Insert cell
rectSelectionXContinuous
Insert cell
viewof rectSelectionY = Plot.plot({
marks: [
Plot.rectX(
penguins,
Plot.binY(
{ x: "count" },
{ y: "body_mass_g", fillOpacity: 0.5, thresholds: 20 }
)
),
Plot.rectX(
penguins,
Plot.brushY(Plot.binY({ x: "count" }, { y: "body_mass_g", thresholds: 20 }))
)
]
})
Insert cell
rectSelectionY
Insert cell
Insert cell
viewof linkSelection = Plot.plot({
grid: true,
inset: 10,
x: {
type: "log",
label: "Population →"
},
y: {
label: "↑ Inequality",
ticks: 4
},
color: {
scheme: "BuRd",
label: "Change in inequality from 1980 to 2015",
legend: true,
tickFormat: "+f"
},
marks: [
Plot.link(metros, {
x1: "POP_1980",
y1: "R90_10_1980",
x2: "POP_2015",
y2: "R90_10_2015",
stroke: (d) => d.R90_10_2015 - d.R90_10_1980,
strokeOpacity: 0.2,
markerEnd: "arrow"
}),
Plot.text(metros, {
x: "POP_2015",
y: "R90_10_2015",
filter: "highlight",
text: "nyt_display",
fill: "currentColor",
stroke: "white",
dy: -8
}),
Plot.link(metros, Plot.brush({
x1: "POP_1980",
y1: "R90_10_1980",
x2: "POP_2015",
y2: "R90_10_2015",
stroke: (d) => d.R90_10_2015 - d.R90_10_1980,
markerEnd: "arrow"
})),
]
})
Insert cell
Insert cell
Plot.plot({
projection: "equal-earth",
marks: [
Plot.geo(countries, Plot.brush(Plot.centroid({ fill: "red" }))),
Plot.geo(countries)
]
})
Insert cell
import {countries} from "@visionscarto/geo"
Insert cell
import {metros} from "@observablehq/plot-link-variation-chart"
Insert cell
Plot = require(await FileAttachment("plot.umd.min.js").url())
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