Public
Edited
Sep 26, 2022
Fork of Earthquakes
Insert cell
# Earthquakes
Insert cell
world
Insert cell
projection = d3.geoEquirectangular()
Insert cell
import {map as world}
with {earthquake as data, projection as projection} from "@d3/world-airports"
Insert cell
mydata = d3.json("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_week.geojson")
Insert cell
earthquake = mydata.features.map(d => ({
name: d.properties.place,
longitude: d.geometry.coordinates[0],
latitude: d.geometry.coordinates[1],
mag: d.properties.mag
}))
Insert cell
d3.select(world)
.selectAll("circle")
.filter(function(d) {return d.mag >= 5})
.style("fill", "crimson")
Insert cell
d3.select(world)
.selectAll("circle")
.filter(function(d) {return d.mag > 4 && d.mag < 5})
.style("fill", "orange")
Insert cell
d3.select(world)
.selectAll("circle")
.filter(function(d) {return d.mag > 3 && d.mag < 4})
.style("fill", "yellow")
Insert cell
d3.select(world)
.selectAll("circle")
.filter(function(d) {return d.mag > 2 && d.mag < 3})
.style("fill", "green")
Insert cell
d3.select(world)
.selectAll("circle")
.filter(function(d) {return d.mag <= 2})
.style("fill", "blue")
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