Published
Edited
May 13, 2021
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 400
Insert cell
width = 700
Insert cell
path_points = d3.geoPath().projection(projection)
Insert cell
path_basemap = d3.geoPath().projection(projection)
Insert cell
projection = d3.geoAlbers()
Insert cell
format = d3.format(".2s")
Insert cell
//proportional symbols
//radius = d3.scaleSqrt([0, d3.max(attribute)], [0, 30])
Insert cell
radius = d3.scaleThreshold()
.domain(naturalbreaks)
.range(radiusArray)
Insert cell
sizeArrayForLegend = Array.from(radiusArray, d=>Math.PI*Math.pow(d, 2))
Insert cell
radiusArray = [1, 7, 21,38, ]
Insert cell
circleLabels = Array.from(naturalbreaks, d=> format(Math.pow(d, 2)))
Insert cell
colors = d3.scaleThreshold()
.domain(naturalbreaks)
.range(YlOrRd)
Insert cell
YlOrRd = ["#f6eff7", "#bdc9e1", "#67a9cf", "#02818a"]
Insert cell
naturalbreaks = simple.ckmeans(attribute, 4).map(v => v.pop())
Insert cell
d3.max(attribute)
Insert cell
attribute = Array.from(points.features, d=>Math.sqrt(d.properties[attributeName]))
Insert cell
//cvs_data = d3.csvParse(await FileAttachment("20to24pop2018pt3.csv").text(),({statename,theyears}) => [statename, [ +theyears]])
Insert cell
attributeName = "20to24po_2"
Insert cell
idName = "STATE_NAME"
Insert cell
//import the point data (geojson)
points = FileAttachment("midwestpoints.geojson").json()
Insert cell
//import the polygon base map data
basepolygons = FileAttachment("midwestbasebb.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
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