Public
Edited
Feb 11, 2024
Insert cell
Insert cell
projection = d3.geoModifiedStereographicLee()
Insert cell
map
Insert cell
taylor_swift_tok_lax_20240210 = FileAttachment(
"taylor_swift_tok_lax_20240210@1.geojson"
).json()
Insert cell
taylor_swift_tok_lax_20240210@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
width = 800
Insert cell
height = 400
Insert cell
svg = html`<svg width="${width}" height="${height}"></svg>`
Insert cell
// projection = geoMercator().translate([width / 2, height / 2])
Insert cell
outline = ({
type: "Polygon",
coordinates: [
[
d3.range(w - 1).map(p => [p, 0]),
d3.range(h - 1).map(q => [w, q]),
d3.range(w, 0, -1).map(p => [p, h]),
d3.range(h - 1, 0, -1).map(q => [0, q])
]
.flat()
.map(projection.scale(w * (225 / 900)).translate([w / 2, h / 2]).invert)
]
})
Insert cell
w = width
Insert cell
h = (width * (2 / 3)) | 0
Insert cell
import {map} with {projection, outline} from "@d3/world-map"
Insert cell
d3 = require("d3@7", "d3-geo-projection@4", "d3-geo-polygon@1", "d3-geo-voronoi@2", "d3-geo@1")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more