Published
Edited
Feb 2, 2022
3 stars
Plot: A few custom time axesAccess to Family planningPlot: MarimekkoAutoplot matrixWhat do people buy on Bandcamp?Plot: colorContrast transformA Timeline of Democratic Presidential CandidatesPlot: Diverging stacked barsPlot: Horizon ChartPlot: Ridgeline PlotTwo-Tone Pseudo Color Scales with Observable Plot & Vega-LiteRecreating Östling’s regression visualizationsError barsPlot: regressionSkies PlotHorizon graph & Barcode with PlotTemporal AliasingPlot for mathematiciansPlot Isotype dot plot
COVID-19 Netherlands Reproduction Number Tutorial
Plot Mountain SunsetSpine chartsGreenhouse gas emission projectionsRaincloud Plots with Observable PlotUpset Plots with Observable PlotExploring CIELChabNature variant waves graphicWhen Presidents Fade AwayThe Coronavirus landscapeOur World In Data charts visualisationThe normal modelVisualizing The New York Times’s Mini CrosswordDistributions and summary statistics - a collection of Plot examplesVariants of SARS-Cov-2 in EuropeLaid off: 6 million jobs and countingConcentration values vs. TimeTopological subsamplingPlot of plotsCyclical time scale, v2Bullet graph IIPlot: Bullet graphCyclical time scaleRoad traffic under COVID restrictions (France)K-means binningMatrix diagramELD ViewerHappy anniversary, Project Gutenberg!ROC curvePlot stargazer historyPlot HyperboloidPhone bar plotsLog-scale histogramDatabase Outage PlotBertin’s hotelIreland’s top trade partnersBump chartBubble MatrixRenko ChartGitHub BurndownPlot: Grid choroplethCandlestick Chart
Also listed in…
COVID
Showroom
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
covid
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
Insert cell
Insert cell
data = rivmData // Map RIVM names to more humanly meaningful names
.filter(p => new Date(p.Date) > asFrom) // Filter Early & Often: Only use valid data and from a specific date
.map(
(k, i) => ({
date: new Date(k.Date),
lower: +k.Rt_low,
R: k.Rt_avg === undefined ? undefined : +k.Rt_avg, // Only include Rt_avg/middle if present
upper: +k.Rt_up,
})
)
Insert cell
Insert cell
Insert cell
import {maatregels} from "@martien/covid-19-reproductiegetal"
Insert cell
measures = maatregels.filter(m => m.datum > asFrom)
Insert cell
Insert cell
Insert cell
Insert cell
defaults = ({
width, // make it as wide as the page
height, // use a constant height throughout the notebook
y: {domain: [0.5, 1.5]}, // so all plots have a consistent scale (and height)
grid: true,
})
Insert cell
Plot.plot({
...defaults,
marks: [
Rline,
]
})
Insert cell
Insert cell
Rline = Plot.line(data, {x: "date", y: "R", stroke: "darkslateblue"})
Insert cell
Insert cell
Insert cell
Plot.plot({
...defaults,
marks: [
Plot.ruleY([baseline], {strokeDasharray: "9"}),
Rline,
]
})
Insert cell
Insert cell
Plot.plot({
...defaults,
marks: [
showBollingerBand ? Plot.areaY(data, {x: "date", y1: "lower", y2: "upper", fill:"gainsboro"}) : [],
Plot.ruleY([baseline], {strokeDasharray: "9"}),
Rline,
]
})
Insert cell
Insert cell
Insert cell
Insert cell
final = Plot.plot({
...defaults,
marks: [

showBollingerBand ? Plot.areaY(data, {x: "date", y1: "lower", y2: "upper", fill:"gainsboro"}) : [],

area("green", data),
area("red", data),

Plot.ruleY([baseline], {strokeDasharray: "9"}),
Rline,
Plot.text(measures, {x: "datum", y: d => textY(d), text: d => d.kern, textAnchor: "start"}),
Plot.ruleX(measures, {x: "datum", y1: _ => 1, y2: d => textY(d)}),
],
// caption: html`Figure 1. This chart has a <i>fancy</i> caption.`,
})
Insert cell
// takes color and data
// returns areaY with color
area = (color, data) =>
Plot.areaY(
data,
{
fill: color,
fillOpacity: .2,
x: "date",
y1: _ => baseline,
y2: d => deltaFromBaseline(color, d.R),
}
)
Insert cell
// takes color and R value
// returns:
// R, when color and value agree: green <= 0, red >= 0
// NaN, otherwise.
deltaFromBaseline = (color, R) => ({
green: R <= baseline,
red: R >= baseline
})[color] ? R : NaN
Insert cell
// takes measure
// returns y position
textY = d => 1.3 + (d.positie - 1) / 25
Insert cell
Insert cell
Insert cell
// Kudos to Aaron Kyle Dennis for this workaround.
// See https://observablehq.com/d/488b4fd9235d5431
cors_proxy = "https://observable-cors.glitch.me/"
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