Public
Edited
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 400 * 2,
height: (400 / volcano.width) * volcano.height - 20,
padding: 0,
margin: 0,
x: { axis: null, range: [0, 400 * 2] },
y: { axis: null, range: [0, (400 / volcano.width) * volcano.height] },
marks: [
Plot.cell(
d3.cross([0, 1], [0]).map(([a, b]) => ({ a, b })),
{
x: "a",
y: "b",
render: (
index,
{ x, y },
{
x: X,
y: Y,
channels: {
x: { value: a },
y: { value: b }
}
}
) =>
d3
.create("svg:g")
.call((g) =>
g
.selectAll()
.data(index)
.join("g")
.attr("transform", (i) => `translate(${X[i] + 10},${Y[i]})`)
.append((i) =>
subPlot(
data,
a[i],
b[i],
x.bandwidth() - 20,
y.bandwidth() - 20
)
)
)
.on(
"pointerenter pointermove",
(event) => (mutable mouse_pos = d3.pointer(event))
)
.node()
}
)
]
})
Insert cell
import { volcano } from "@observablehq/plot-volcano-raster"
Insert cell
data = [
[{ ...volcano, ...{ scheme: "Magma" } }],
[
{
...volcano,
...{
scheme: "Turbo",
values: volcano.values.map(
(d) => Math.sin((2 * Math.PI * d) / Math.max(...volcano.values)) ** 2
)
}
}
]
]
Insert cell
subPlot = (data, a, b, width, height) =>
Plot.plot({
width,
height,
margin: 0,
color: { scheme: data[a][b].scheme },
marks: [
Plot.raster(data[a][b].values, {
width: data[a][b].width,
height: data[a][b].height
})
],
x: { axis: false },
y: { axis: false }
})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more