Published
Edited
Mar 22, 2019
8 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
plastic = {
const p1 = 0.7548776662466927; // inverse of plastic number
const p2 = 0.5698402909980532;
return function plastic (index) {
return [(p1 * index) % 1, (p2 * index) % 1];
}
}
Insert cell
golden = {
const p = 0.618033988749894848; // inverse of golden ratio
return function golden (index) {
return p * index % 1;
}
}
Insert cell
halton23 = function halton23 (index) {
return [halton(index, 2), halton(index, 3)]
}
Insert cell
halton = function halton (index, base) {
let fraction = 1;
let result = 0;
while (index > 0) {
fraction /= base;
result += fraction * (index % base);
index = ~~(index / base); // floor division
}
return result;
}
Insert cell
Insert cell
npts = 4000
Insert cell
data = [...Array(npts).keys()].map(halton23)
Insert cell
plastic_data = [...Array(npts).keys()].map(plastic)
Insert cell
coloring = (d, i) => d3.interpolatePurples(Math.pow(i/npts, 5))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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