Published unlisted
Edited
Sep 14, 2022
1 star
Insert cell
Insert cell
Plot.plot({
marginLeft: 75,
marginRight: 70,
x: { insetRight: 10 },
facet: { data: penguins, y: "island", marginRight: 70 },
marks: [
Plot.frame(),
Plot.barX(
penguins,
Plot.groupY({ x: "count" }, { y: "species", fill: "sex" })
),
Plot.text(["Torgersen only has Adelie penguins!"], {
frameAnchor: "top-right",
dx: -10,
fy: ["Torgersen"]
})
]
})
Insert cell
Plot.plot({
marginLeft: 75,
marginRight: 70,
x: { insetRight: 10 },
marks: [
Plot.frame(),
Plot.barX(
penguins,
Plot.groupY({ x: "count" }, { y: "species", fill: "sex", fy: "island" })
),
Plot.text(["Torgersen only has Adelie penguins!"], {
frameAnchor: "top-right",
dx: -10,
fy: ["Torgersen"]
})
]
})
Insert cell
Plot.plot({
marginLeft: 75,
marginRight: 70,
x: { insetRight: 10 },
facet: { marginRight: 70 },
marks: [
Plot.frame(),
Plot.barX(
penguins,
Plot.groupY({ x: "count" }, { y: "species", fill: "sex", fy: "island" })
),
Plot.text(["Torgersen only has Adelie penguins!"], {
fy: ["Torgersen"],
frameAnchor: "top-right",
dx: -10
})
]
})
Insert cell
Plot.plot({
height: 250,
width: 250,
color: { type: "ordinal", scheme: "tableau10" },
axis: null,
marks: [
Plot.rect("12345", { fy: (d) => d, fill: (d) => d }),
Plot.dot("12345", {
frameAnchor: "middle",
r: 19,
fill: (d) => d,
stroke: "white",
fx: (d) => d
}),
Plot.text(d3.cross("12345", "12345"), {
frameAnchor: "middle",
text: ([a, b]) => a * b,
fill: "white",
fx: (d) => d[1],
fy: (d) => d[0]
})
]
})
Insert cell
Plot.text(["Hello\nyou\nare\nhere"], {
frameAnchor: "bottom-right"
}).plot()
Insert cell
Plot.plot({
marks: [
Plot.frame(),
Plot.dot(penguins, {
x: "culmen_length_mm",
y: "culmen_depth_mm",
fill: "sex",
fx: "species",
fy: "island"
})
]
})
Insert cell
Insert cell
Insert cell
{
const data = Float64Array.of(1, 2, 3);
const facets = ["a", "b", "c"];
return Plot.plot({
height: 180,
facet: {data, x: facets},
marks: [
(fix ? Plot : PlotMain).barY(data, {
stroke: (d) => d, // channel as accessor
fill: data, // channel as array
fillOpacity: 0.5,
facet: "exclude"
})
]
});
}
Insert cell
Plot = FileAttachment("plot@6.umd.js").url().then(require)
Insert cell
PlotMain = require("@observablehq/plot@0.6")
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