Published
Edited
Aug 6, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
reg_growth_tot = regions_incidence.map(reg => {
const nSmth = 7;
const si = 5;
const casesGr = reg.series.map((s, idx) => {
if (idx<7) {
return null;
}
const c0 = reg.cases_todate[idx-7] - (reg.cases_todate[idx-8-nSmth] || 0);
const c1 = reg.cases_todate[idx] - reg.cases_todate[idx-1-nSmth];
return {
id: reg.id,
name: reg.name,
date: s.date,
population: reg.population,
cases_todate: reg.cases_todate[idx],
cases_todate_per100k: reg.cases_todate[idx]/reg.population*100000,
growth: c1/c0,
growth_nat: Math.pow(c1/c0, si/7)
};
});
return casesGr;
}).flat().filter(a => a && a.growth > 0 && Number.isFinite(a.growth));
Insert cell
Plot.plot({
facet: {
data: reg_growth_tot,
y: "id"
},
y: {
type: "linear",
domain: [0.8, 2]
},
x: {
type: "linear",
grid: true
},
width: width,
marks: [
Plot.line(reg_growth_tot, {x: "cases_todate_per100k", y: "growth_nat", stroke: s => strFromDate(s.date).substring(0,5)}),
Plot.ruleY([1])
]
})
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