Published
Edited
Jul 6, 2022
Insert cell
Insert cell
2 + 4
Insert cell
greet("members of the data viz meetup")
Insert cell
function greet(name) {
return "Hello, " + name;
}
Insert cell
Insert cell
Insert cell
import { countries } from "@ee2dev/plot-party"
Insert cell
countries
Insert cell
Inputs.table(countries)
Insert cell
import { SummaryTable } from "@observablehq/summary-table"
Insert cell
SummaryTable(countries)
Insert cell
Plot.plot({
marginLeft: 100,
height: 3000,
marks: [
Plot.dot(countries, {
y: "country",
x: "area"
})
]
})
Insert cell
Plot.plot({
marginLeft: 100,
height: 3000,
marks: [
Plot.dot(countries, {
y: "country",
x: "area",
r: 5,
fill: "region"
})
]
})
Insert cell
Plot.plot({
marginLeft: 100,
height: 3000,
marks: [
Plot.dot(countries, {
y: "country",
x: "area",
r: 5,
fill: "region",
sort: { y: "x" }
})
]
})
Insert cell
Plot.plot({
marginLeft: 100,
height: 3000,
marks: [
Plot.dot(countries, {
y: "country",
x: "area",
r: 5,
fill: "region",
sort: { y: "x", reverse: true }
})
]
})
Insert cell
Plot.plot({
marginLeft: 100,
marks: [
Plot.dot(countries, {
y: "country",
x: "area",
r: 5,
fill: "region",
sort: { y: "x", reverse: true, limit: 30 }
})
]
})
Insert cell
Insert cell
select
Insert cell
Plot.plot({
marginLeft: 100,
marks: [
Plot.dot(countries, {
y: "country",
x: select,
r: 5,
fill: "region",
sort: { y: "x", reverse: true, limit: 30 }
})
]
})
Insert cell
Plot.plot({
facet: {
data: penguins,
x: "species"
},
marks: [
Plot.frame(),
Plot.dot(penguins, {x: "culmen_length_mm", y: "culmen_depth_mm"})
]
})
Insert cell
viewof myCountry = Inputs.select(getCategories("country"), {
label: "Select country"
})
Insert cell
Plot.plot({
height: 600,
width,
inset: 5,
facet: {
data: countries,
x: "region"
},
marks: [
Plot.frame(),
Plot.dot(countries, {
x: "fert_rate",
y: "area",
fill: "region",
fillOpacity: (d) => (d.country === myCountry ? 1 : 0.1),
r: 5,
stroke: "black",
strokeOpacity: (d) => (d.country === myCountry ? 1 : 0.1)
}),
Plot.text(countries, {
x: "fert_rate",
y: "area",
text: "country",
fillOpacity: (d) => (d.country === myCountry ? 1 : 0),
textAnchor: "start",
dx: 10,
dy: -10,
fontSize: 16
})
]
})
Insert cell
Treemap(flare, {
path: (d) => d.name.replaceAll(".", "/"), // e.g. flare/animate/Easing
label: (d) => d.name.split(".").pop(), // display text
group: (d) => d.name.split(".")[1], // for color; e.g. animate
value: (d) => d?.size, // area of each rect
title: (d, n) => [n.id, n.value.toLocaleString()].join("\n"), // hover text
width,
height: 500
})
Insert cell
[...new Set(countries.map((d) => d.region))]
Insert cell
function getCategories(column) {
return [...new Set(countries.map((d) => d[column]))];
}
Insert cell
getCategories("region")
Insert cell
import {Treemap} from "@d3/treemap"
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