Public
Edited
Nov 12, 2022
3 stars
Insert cell
Insert cell
Inputs.table(data)
Insert cell
Insert cell
Insert cell
Insert cell
chart2 = Choropleth(data, {
id: (d) => d.name, // country name, e.g. Zimbabwe
value: (d) => d.contributors_per_100k, // health-adjusted life expectancy
range: d3.interpolateBuPu,
features: countries,
featureId: (d) => d.properties.name, // i.e., not ISO 3166-1 numeric
borders: countrymesh,
projection: d3.geoEqualEarth(),
width
})
Insert cell
Insert cell
total_contributors = d3.sum(data_all, (d) => d.count_total_contributors)
Insert cell
data_all = data_raw[0]
Insert cell
Insert cell
Insert cell
Insert cell
world = FileAttachment("countries-50m.json").json()
Insert cell
countries = topojson.feature(world, world.objects.countries)
Insert cell
Insert cell
countrymesh = topojson.mesh(world, world.objects.countries, (a, b) => a !== b)
Insert cell
Insert cell
chart32 = Choropleth(intellij2021, {
id: (d) => d.name, // country name, e.g. Zimbabwe
value: (d) => d.countshare, // health-adjusted life expectancy
range: d3.interpolateBuPu,
features: countries,
featureId: (d) => d.properties.name, // i.e., not ISO 3166-1 numeric
borders: countrymesh,
projection: d3.geoEqualEarth(),
width
})
Insert cell
Insert cell
_sharing_data_outside = FileAttachment("2021_sharing_data_outside.csv").csv({
typed: true
})
Insert cell
Inputs.table(_sharing_data_outside)
Insert cell
_sharing_data_outside.filter(function (d) {
return d["country.live"] != null;
})
Insert cell
pythondevcountries = d3
.flatRollup(
_sharing_data_outside.filter(function (d) {
return d["country.live"] != null;
}),
(v) => v.length,
(d) => d["country.live"]
)
.map(([Country, Count]) => ({ Country, Count }))
Insert cell
total_respondends = d3.sum(pythondevcountries, (d) => d.Count)
Insert cell
intellij2021 = pythondevcountries.map((d) => ({
name: rename.get(d.Country) || d.Country,
count: +d.Count,
countshare: +d.Count / total_respondends
}))
Insert cell
import {Choropleth, Legend} from "@d3/choropleth"
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