Skip to content

Instantly share code, notes, and snippets.

View mbostock's full-sized avatar
📊
Plottin’

Mike Bostock mbostock

📊
Plottin’
View GitHub Profile
<!DOCTYPE html>
<p id="greeting"></p>
<script type="module">
import {Runtime, Inspector, Library} from "https://unpkg.com/@observablehq/notebook-runtime?module";
import notebook from "https://api.observablehq.com/d/6c9b7fd62ca784c0.js";
// Rewrite the notebook to redefine the “subject” cell in the main module.
const override = {
id: notebook.id,
@mbostock
mbostock / index.html
Created August 14, 2018 14:16
Override cells
<!DOCTYPE html>
<div id="test"></div>
<script type="module">
import {Runtime, Inspector, Library} from "https://unpkg.com/@observablehq/notebook-runtime?module";
import notebook from "https://api.observablehq.com/d/f523a66288d9ab04.js?key=e76719d4648ff9ff";
const test = document.querySelector("#test");
const main = {
@mbostock
mbostock / index.html
Created August 10, 2018 01:40
Overriding notebook-stdlib
<!DOCTYPE html>
<style>
#test {
max-width: 480px;
width: 50%;
margin: auto;
background: #ccc;
}

A demonstration of repurposing code from an Observable notebook without Observable’s reactive runtime.

It’s a shark!

Mauna Loa CO2 weekly mean and historical comparisons

Source: NOAA ESRL

@mbostock
mbostock / README.md
Created January 29, 2018 17:14
U.S. Historical Tax Rates

Amounts are in 2013-equivalent dollars when filing as the head-of-household.

Sources: Vox, Tax Foundation

Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec J-D D-N DJF MAM JJA SON
1880 -.30 -.21 -.18 -.27 -.14 -.29 -.24 -.08 -.17 -.16 -.19 -.22 -.20 *** *** -.20 -.20 -.17
1881 -.10 -.14 .01 -.03 -.04 -.28 -.07 -.03 -.09 -.20 -.26 -.16 -.12 -.12 -.15 -.02 -.13 -.19
1882 .09 .08 .01 -.20 -.18 -.25 -.11 .03 -.01 -.23 -.21 -.25 -.10 -.09 .00 -.12 -.11 -.15
1883 -.34 -.42 -.18 -.25 -.26 -.13 -.09 -.14 -.19 -.12 -.21 -.19 -.21 -.22 -.34 -.23 -.12 -.18
1884 -.18 -.13 -.36 -.36 -.32 -.38 -.35 -.27 -.24 -.22 -.30 -.30 -.28 -.28 -.17 -.35 -.33 -.25
1885 -.66 -.30 -.24 -.45 -.42 -.50 -.29 -.27 -.19 -.20 -.22 -.07 -.32 -.33 -.42 -.37 -.35 -.20
1886 -.43 -.46 -.41 -.29 -.27 -.39 -.16 -.31 -.19 -.25 -.26 -.25 -.31 -.29 -.32 -.33 -.29 -.23
1887 -.66 -.48 -.32 -.37 -.33 -.21 -.19 -.28 -.19 -.32 -.25 -.38 -.33 -.32 -.46 -.34 -.22 -.26
1888 -.43 -.43 -.47 -.28 -.22 -.20 -.10 -.11 -.07 .01 .00 -.12 -.20 -.22 -.41 -.33 -.14 -.02