Published
Edited
Jul 12, 2021
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
facet: {
data,
y: "species",
marginLeft: 80
},
marks: [
Plot.frame(),
Plot.dot(data, {
transform: facetExclusion,
x: "body_mass",
fill: "#ccc"
}),
Plot.dot(data, {
x: "body_mass",
fill: "species"
})
]
})
Insert cell
Insert cell
Plot.plot({
facet: {
data,
y: "species",
marginLeft: 80
},
marks: [
Plot.frame(),
Plot.dot(data, {
transform: facetExclusion,
x: "body_mass",
fill: "#ccc"
}),
Plot.dot(data, {
x: "body_mass",
fill: "species"
}),
Plot.tickX(
data,
Plot.groupZ(
{ x: "median" },
{
transform: facetExclusion,
x: "body_mass",
stroke: "#aaa",
strokeWidth: 1
}
)
),
Plot.tickX(
data,
Plot.groupZ(
{ x: "median" },
{ x: "body_mass", stroke: "species", strokeWidth: 3 }
)
)
]
})
Insert cell
// todo: Plot plugin
facetExclusion = (data, facets) => {
return {
data,
facets: facets.map((f) => Array.from(d3.difference(d3.range(data.length), f)))
};
}
Insert cell
import {data} from "@observablehq/plot-exploration-penguins"
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