Public
Edited
Apr 29, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof Gender = Inputs.radio(["Male", "Female"], {
label: "Gender:",
value: "Male"
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { build_samples } from "@mcmcclur/adaptive-plotter"
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(dogs, { x: "name", y: selection, fill: "weight", r: selection2 })
]
})
Insert cell
Insert cell
Inputs.table(wb_data)
Insert cell
data_2019 = wb_data.filter(row => row.year === 2019)
Insert cell
Inputs.table(data_2019)
Insert cell
world_bank_data@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width,
height: 500,
marks: [
Plot.rectY(data_2019, Plot.binX({y: "count"}, {x: "life", fill: "region"})),
Plot.ruleY([0])
],
color: {
legend: true
},
facet: {
data: data_2019,
y: "region",
x: "income_group",
marginRight: 150,
label: null
}
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(data_2019, {
x: "gdp",
y: "life",
fill: "region",
r: "population"
})
],
x: { type: "log" },
color: { legend: true, scheme: "blues" }
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
scatterChart = addTooltips(
Plot.plot({
width,
facet: {
data: filterData,
x: "region"
},
marks: [
Plot.dot(filterData, {
x: "gdp",
y: "life",
fill: "country",
r: "population",
title: (d) => `${d.country}`
})
],
x: { type: "log", domain: d3.extent(wb_data, (d) => d.gdp) },
y: { type: "log", domain: d3.extent(wb_data, (d) => d.life) }
// color: { legend: true, scheme: "blues" }
}),
{ fill: "black" }
)
Insert cell
Insert cell
Insert cell
Insert cell
d3.extent(wb_data, (d) => d.year)
Insert cell
viewof selectedYear = Inputs.range(
d3.extent(wb_data, (d) => d.year),
{ label: "Selected Year", step: 1, value: d3.min(wb_data, (d) => d.year) }
)
Insert cell
Insert cell
barRaceSub = wb_data.filter((d) => d.year === selectedYear)
Insert cell
addTooltips(
Plot.plot({
width,
marks: [
Plot.barX(barRaceSub, {
x: "gdp",
y: "country",
fill: "country",
title: (d) =>
`${d.country}\n had a GDP value of ${round(
d.gdp / 1000000000000,
2
)} trillions`,
sort: { y: "x", reverse: true, limit: 10 }
}),
Plot.ruleX([0])
],
marginLeft: 350
}),
{ fill: "black" }
)
Insert cell
temperature_data = [
{ x: 0, y: 60, time: "induction" },
{ x: 1, y: 60, time: "induction" },
{ x: 2, y: 60, time: "induction" },
{ x: 3, y: 30, time: "induction" },
{ x: 4, y: 30, time: "maintenance" },
{ x: 5, y: 30, time: "maintenance" },
{ x: 6, y: 30, time: "maintenance" },
{ x: 7, y: 30, time: "maintenance" },
{ x: 11, y: 60, time: "rewarming" },
{ x: 12, y: 60, time: "rewarming" },
{ x: 13, y: 60, time: "rewarming" }
]
Insert cell
addTooltips(
Plot.plot({
width,
marks: [
Plot.line(temperature_data, {
x: "x",
y: "y"
// fill: "time",
})
],
marginLeft: 10
}),
{ fill: "black" }
)
Insert cell
round = (n, places) => {
if (!places) return Math.round(n);
const d = 10 ** places;
return Math.round(n * d) / d;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
db = DuckDBClient.of({
wb_data,
codes: FileAttachment("country_codes@1.csv")
})
Insert cell
wb_data
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
import { DuckDBClient } from "@cmudig/duckdb-client"
Insert cell
import { Choropleth, countries, countrymesh } from "@d3/world-choropleth"
Insert cell
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
country_codes = FileAttachment("country_codes@1.csv").csv()
Insert cell
world_bank_data = FileAttachment("world_bank_data@1.csv").csv()
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