Unlisted
Edited
Dec 21, 2022
Insert cell
Insert cell
Plot.plot({
facet: { data: penguins, x: "island" },
marks: [
Plot.rectY(penguins, {
...Plot.binX(
{
data: (data) => data[0], // select the first element, for no reason
y: "count"
},
{
x: "body_mass_g",
z: "species"
}
),
fill: "sex" // get the color from the first element
})
]
})
Insert cell
Plot.plot({
facet: { data: penguins, x: "island" },
marks: [
Plot.rectY(penguins, {
...Plot.binX(
{
data: (data) => data[0], // select the first element, for no reason
y: "count",
title: data => mutable hello = data /// ???
},
{
x: "body_mass_g",
z: "species",
}
),
fill: "species" // get the color from the first element
})
]
})
Insert cell
mutable hello = null
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