A demonstration of repurposing code from an Observable notebook without Observable’s reactive runtime.
Instantly share code, notes, and snippets.
View mbostock's full-sized avatar
📊
Plottin’
Mike Bostock mbostock
📊
Plottin’
Building a better computational medium. Co-founder @observablehq. Creator @d3. Former @nytgraphics. Pronounced BOSS-tock.
- San Francisco, CA
- https://observablehq.com/@mbostock
- @ocks.org
- @mbostock
mbostock
/ index.html
Last active
December 4, 2023 20:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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 = {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html>
<style>
#test {
max-width: 480px;
width: 50%;
margin: auto;
background: #ccc;
}
A demonstration of downloading and embedding an Observable notebook.
It’s a shark!
Mauna Loa CO2 weekly mean and historical comparisons
Source: NOAA ESRL
Amounts are in 2013-equivalent dollars when filing as the head-of-household.
Sources: Vox, Tax Foundation
mbostock
/ temperatures.csv
Created
January 28, 2018 15:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
NewerOlder