Published
Edited
Dec 18, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
all_brackets = {
return brackets.map((e,i) => {
let value;
if (povcal_pop[i]) value = povcal_pop[i];
return { date: e, value }
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { margin, height }
from "@d3/scatterplot"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
reg = regression.power(bill_brackets.map(e => [e.x, e.y]))
Insert cell
Insert cell
bill_brackets = {
const lowestbill = billionaire_incomes[billionaire_incomes.length-1];
const lowest_index = d3.bisect(brackets, lowestbill) - 1;
const brackets_bill = brackets.slice(lowest_index);
const brackets_count = brackets_bill.map(e => ({ x: e, y: 0 }));
for (let inc of billionaire_incomes) {
let i = d3.bisect(brackets_bill, inc);
brackets_count[i-1].y = 1;
}
return brackets_count.filter(e => e.y != 0);
}
Insert cell
Insert cell
Insert cell
povcal_pop = pop_per_bracket_string.split('\n').map(parseFloat).map(e => e*world_pop/1000)
Insert cell
Insert cell
billionaire_incomes = billionaire_incomes_string.split('\n').map(parseFloat);
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
regression = require("regression")
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