Public
Edited
Oct 26, 2022
3 stars
Insert cell
Insert cell
Plot.plot({
height: 240,
facet: {
data: anscombe,
x: "series"
},
marks: [
Plot.frame(),
Plot.dot(anscombe, {x: "x", y: "y"}),
Plot.ruleY(
anscombe, // object must === the facet data
Plot.groupZ(
{ y: "median" }, // the reducer you want to apply
{ y: "y" } // the dimension you want to apply the reducer to
)
)
]
})
Insert cell
Insert cell
Insert cell
Insert cell
medians = d3.rollups(anscombe, arr => d3.median(arr, d => d.y), d => d.series)
Insert cell
Insert cell
Plot.plot({
height: 240,
facet: {
data: anscombe,
x: "series"
},
marks: [
Plot.frame(),
Plot.dot(anscombe, {x: "x", y: "y"}),
Plot.ruleY(medians, {y: "1"})
]
})
Insert cell
Insert cell
Plot.plot({
height: 120,
marks: [
Plot.ruleY(anscombe, Plot.groupZ({y: "median"}, {z: "series", y: "y"}))
]
})
Insert cell
Insert cell
import {anscombe} from "@observablehq/plot-facets"
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