Published
Edited
Nov 24, 2021
2 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
// Plot.rectY(dataColored.features.map(d=>d.properties).filter(d=>d.pop_den<50000), Plot.binX({y: "proportion"}, {x: d=>d.IMP*d.pop_den/1000})).plot()
Insert cell
// Plot.rectY(dataColored.features.map(d=>d.properties), Plot.binX({y: "proportion"}, {x: "IMP"})).plot()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
svg
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {Plot} from "@observablehq/plot"
Insert cell
Insert cell
SansSerifFont = "Oswald"
Insert cell
Insert cell
`https://fonts.googleapis.com/css2?family=${SansSerifFont}&display=swap`
Insert cell
html`
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=${SerifFont}:ital@0;1&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=${SansSerifFontParse}&display=swap">
<style>

body, svg {
font-family: '${SansSerifFont}', sans-serif;
font-weight: 400
/* font-size: 48px; */
}

.mapTitle {

font-family: '${SansSerifFont}', sans-serif;
font-weight: 600;
font-size: 60px;
text-transform:uppercase

}

.mapSubTitle {

font-family: '${SansSerifFont}', sans-serif;
font-weight: 400;
font-size: 25px;
}

.mapCredit {

font-family: '${SansSerifFont}', sans-serif;
font-weight: 700;
font-size: 12px;
}

.legend {
font-family: '${SansSerifFont}', sans-serif;
font-weight: 600;
font-size: 9.5px;
text-transform:uppercase
}

.tooltipInfo {
font-family: '${SansSerifFont}', sans-serif;
font-weight: 300;
font-size: 13px;
}
</style>`
Insert cell
// function renderMapboxHalftone(map) {
// const sourceId = 'van-blocks';
// // const layerId = `${sourceId}-layer`;
// const layerId_imp = `${sourceId}-imp`;
// const layerId_pop = `${sourceId}-pop`;

// let source = map.getSource(sourceId);

// let pattern = {
// 'id': 'pattern',
// 'type': 'fill',
// 'source': 'data',
// "sprite": "mapbox://sprites/mapbox/bright-v8",
// // 'source': 'snailbones.dc1c6wzp',
// 'paint': {
// // 'fill-pattern': "curve-09",
// "fill-pattern": ["step",["get","IMP"],"curve-10",20,"curve-09",40,"curve-11", 50, "curve-12", 100, "curve-13"],
// "fill-opacity": .9,
// // "fill-translate": [-100,-100],
// // "fill-translate-transition": 500,
// }
// }
// // Add the source and layer if we haven't created them yet
// if (!source) {
// map.addSource(sourceId, {
// type: 'geojson',
// data: data
// });
// map.addLayer({
// id: layerId_imp,
// source: sourceId,
// type: 'fill',
// interactive: false,
// paint: {
// // 'fill-outline-color': 'white',
// // 'fill-outline-color': 'rgba(0,0,0,0)',
// }
// });
// map.addLayer({
// id: layerId_pop,
// source: sourceId,
// type: 'fill',
// interactive: false,
// paint: {
// // 'fill-outline-color': 'white',
// // 'fill-outline-color': 'rgba(0,0,0,0)',
// }
// });
// // map.addLayer({
// // 'id': layerId_imp,
// // 'type': 'fill',
// // 'source': sourceId,
// // // "source-layer": layerId_imp,
// // 'paint': {
// // // 'fill-pattern': "curve-09",
// // "fill-pattern": ["step",["get","IMP"],"yellow-1",0.3,"yellow-2",0.4,"yellow-3", 0.5, "yellow-4", 0.6, "yellow-5", 0.7, "yellow-6"],
// // "fill-opacity": .8,
// // }
// // }, layerId_imp);
// // map.addLayer({
// // "id": layerId_pop,
// // "type": "fill",
// // "source": sourceId,
// // // "source-layer": layerId_imp,
// // "paint": {
// // "fill-pattern": ["step",["get","pop_den"],"magenta-1",10,"magenta-2",100,"magenta-3", 500, "magenta-4", 2000, "magenta-5", 10000, "magenta-6"],
// // "fill-opacity": .4
// // }}, layerId_imp); // Place polygon under these labels.
// // source = map.getSource(sourceId);
// // }

// // Update the geojson data
// source.setData(data);
// // Update the layer paint properties, using the current config values
// // map.setPaintProperty(layerId_imp, 'fill-color', {
// // property: 'IMP',
// // stops: [
// // [0.3, config.colorScaleImp[1]],
// // [0.4, config.colorScaleImp[2]],
// // [0.5, config.colorScaleImp[3]],
// // [0.6, config.colorScaleImp[4]],
// // [0.7, config.colorScaleImp[5]],
// // [0.8, config.colorScaleImp[6]],
// // [0.9, config.colorScaleImp[6]],
// // [1, config.colorScaleImp[6]],
// // ]
// // });

// // map.setPaintProperty(layerId_pop, 'fill-color', {
// // property: 'pop_den',
// // stops: [
// // [10, config.colorScalePop[1]],
// // [100, config.colorScalePop[2]],
// // [200, config.colorScalePop[3]],
// // [500, config.colorScalePop[4]],
// // [2000, config.colorScalePop[5]],
// // [10000, config.colorScalePop[6]],
// // [20000, config.colorScalePop[6]],
// // [100000, config.colorScalePop[6]],
// // ]
// // });

// // // tooltip
// // map.on('click', layerId, (e) => {
// // new mapboxgl.Popup()
// // .setLngLat(e.lngLat)
// // .setHTML("Accessibility: " + (e.features[0].properties.value).toFixed(2))
// // .addTo(map);
// // });
// // // Change the cursor to a pointer when
// // // the mouse is over the states layer.
// // map.on('mouseenter', layerId, () => {
// // map.getCanvas().style.cursor = 'pointer';
// // });

// // // Change the cursor back to a pointer
// // // when it leaves the states layer.
// // map.on('mouseleave', layerId, () => {
// // map.getCanvas().style.cursor = '';
// // });
// // map.setPaintProperty(layerId_imp, 'fill-opacity', config.fillOpacity);
// // map.setPaintProperty(layerId_pop, 'fill-opacity', config.fillOpacity);

// }
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