Public
Edited
Sep 25, 2024
1 fork
14 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viz = require(`geoviz@0.5.0`)
Insert cell
xyz
Insert cell
svg = {
// Font
viz.tool.addfonts([
{
fontFamily: "Wallpoet",
url: await FileAttachment("Wallpoet-Regular.ttf").url()
}
]);
// Container
let svg = viz.create({
projection: d3.geoIdentity().reflectY(true),
domain: [
[-135, 75],
[165, -50]
],
margin: [-20, 0, 0, 0],
background: "#333335"
});

return svg;
}
Insert cell
l = viz.tool.ridge(xyz, {
z: "value",
k: k,
projection: svg.projection
})
Insert cell
svg.path({
id: "ridge",
coords: "svg",
data: l,
stroke: "#ffb619",
strokeWidth: 0.7,
fill: "#262728"
})
Insert cell
svg.legend.spikes({
id: "legspikes",
data: xyz.map((d) => d.value),
k,
spike_straight: 1,
spike_width: 10,
spike_stroke: "#ffb619",
title: "Number of\ninhabitants",
text_fill: "#ffb619",
values_fill: "#ffb619",
pos: [50, 240]
})
Insert cell
viz.header(svg, {
id: "header",
rect_fillOpacity: 1,
fontSize: 45,
fillOpacity: 1,
fill: "#ffb619",
fontFamily: "Wallpoet",
text: "- World Population -",
background_fill: "#333335",
background_stroke: "#333335"
})
Insert cell
viz.footer(svg, {
id: "footer",
text: "Map design: Nicolas LAMBERT, 2023\nSources: Gridded Population of the World, Version 4 (GPWv4): Population Count, Revision 11",
textAnchor: "end",
fontSize: 8,
margin: 8,
fill: "#ffb619",
background_fill: "#333335",
background_stroke: "#333335"
})
Insert cell
Insert cell
Insert cell
Insert cell
xyz = grid.filter((d) => d.value > filter)
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