Public
Edited
Mar 1, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 700
Insert cell
width = 700
Insert cell
pointsPerRotation = 200
Insert cell
totalPoints = numRotations * pointsPerRotation
Insert cell
path_angle = Math.PI/4
Insert cell
Insert cell
Insert cell
pTheta = thetaScale(totalPoints)
Insert cell
population_scaler = d3.scaleLinear().domain([0, d3.max(data.map(v => v.Population))]).range([0, max_scale])
Insert cell
thetaScale = d3
.scaleLinear()
.domain([0, totalPoints])
.range([0, numRotations * (Math.PI * 2) + 7*(Math.PI / 4)])
Insert cell
calculate_new_point = (dest, orig, angle) => {
// calculate new point in cartesian changed by an angle
let x = Math.cos(angle)*(orig[0] - dest[0]) - Math.sin(angle)*(orig[1] - dest[1]) + dest[0]
let y = Math.sin(angle)*(orig[0] - dest[0]) + Math.cos(angle)*(orig[1] - dest[1]) + dest[1]
return [x, y]
}
Insert cell
import {
thetaToRadius,
radiusToTheta,
toCartesian,
thetaToCartesian,
thetaToArcLength,
spiralDistanceBetweenBranches
} from "@lukesmurray/archimedean-spiral"
Insert cell
import { Range } from "@observablehq/inputs"
Insert cell
Insert cell
pop = data.map(d => d.Population)
Insert cell
data.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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