Public
Edited
May 18, 2023
8 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
city_data = d3.csvParse(
`city,lat,lon
Asheville,35.6,-82.55
Charlotte,35.2271,-80.8431
Durham,35.994,-78.8986
Fayetteville,35.0527,-78.8784
Greensboro,36.0964835,-79.8271079
Greenville,35.6127,-77.3664,
Raleigh,35.7796,-78.6382
Rocky Mount,35.9382,-77.7905
Wilmington,34.2104,-77.886
Winston-Salem,36.0999,-80.2442`,
d3.autoType
)
Insert cell
// In order for the density to correspond to number of people injured or killed,
// we need to modify the data to have one point for each person injured or killed.
d_data = data
.map(function (d) {
let n = d.killed + d.injured;
return d3.range(n).map((o) => ({ lat: d.lat, lon: d.lon }));
})
.flat()
Insert cell
data = FileAttachment("gva_nc_2022.csv").csv({ typed: true })
Insert cell
nc = {
let nc = await FileAttachment("nc.json").json();
let boundary = topojson.feature(nc, nc.objects.nc);
let roads = topojson.feature(nc, nc.objects.roads);
return { boundary, roads };
}
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