Public
Edited
Jan 18, 2023
4 forks
Importers
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data_AFG = _data.AFG.data.map(d => ({id: 'AFG', parsedDate: new Date(d.date), ...d}))
Insert cell
Insert cell
Insert cell
data_ALL = Object.entries(_data)
.map(([key, value]) => (
[...value.data.map(d => ({id: key, parsedDate: new Date(d.date), ...d}))]
))
Insert cell
Insert cell
data_ALL_flat = data_ALL.flat()
Insert cell
Insert cell
Insert cell
Insert cell
data = data_ALL_flat.filter(d => countries.includes(d.id))
.filter(d => d.parsedDate < new Date("2020-09-01"))
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.line(data, {
x: "parsedDate",
y: "new_cases_smoothed_per_million",
z: "id"
})
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.line(data.filter(d => d.parsedDate > new Date("2020-04-15") && d.parsedDate < new Date("2020-05-01")), {x: "parsedDate", y: "new_cases_smoothed_per_million", z: "id", curve: "natural"})
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(connected, {x: "stringency_index", y: "reproduction_rate", fill: "currentColor"}),
Plot.line(connected, {x: "stringency_index", y: "reproduction_rate", z: "id", curve: "natural"})
]
})
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
label: ""
},
marks: [
Plot.ruleY([0]),
Plot.line(data, {x: "parsedDate", y: "total_cases_per_million", z: "id", curve: "natural"})
]
})
Insert cell
Insert cell
Plot.plot({
y: {
type: "log",
grid: true,
label: ""
},
marks: [
Plot.ruleY([0]),
Plot.line(data, {x: "parsedDate", y: "total_cases_per_million", z: "id", curve: "natural"})
]
})
Insert cell
Insert cell
Plot.plot({
y: {
type: "log",
grid: true,
label: "",
},
color: { legend: true },
marks: [
Plot.ruleY([0]),
Plot.line(data, {x: "parsedDate", y: "total_cases_per_million", stroke: "id", curve: "natural"})
],
})
Insert cell
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
},
marks: [
Plot.ruleY([0]),
Plot.areaY(data, {x: "parsedDate", y: "total_cases", z: "id", fill: "black"})
]
})
Insert cell
Insert cell
Plot.plot({
y: {
grid: true,
},
color: { legend: true },
marks: [
Plot.ruleY([0]),
Plot.areaY(data, {x: "parsedDate", y: "total_cases", fill: "id"})
]
})
Insert cell
Insert cell
stream.legend("color")
Insert cell
stream = Plot.plot({
width: width,
y: {
grid: true
},
marks: [
Plot.areaY(data_ALL_flat, Plot.stackY({offset: "silhouette", order: "inside-out", x: "parsedDate", y: "new_cases_smoothed", fill: "id"})),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
grid: true,
width: width,
height: width / 6,
facet: {
data: data,
x: "id"
},
y: {
grid: true,
label: ""
},
marks: [
Plot.ruleY([0]),
Plot.line(data, {
x: "parsedDate",
y: "new_cases_smoothed_per_million",
z: "id",
curve: "natural"
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
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