Public
Edited
Nov 12, 2023
Insert cell
Insert cell
Plot.plot({
width: 900,
height: 600,
projection: projection2,
marks: [
Plot.geo(accidents, {
stroke: "red",
tip: true
})
]
})
Insert cell
list=accidents.map((d) => d.properties.region)
Insert cell
{const getColorForRegion = (region) => {
const colorMap = {
"LUX": "blue", // Use your desired color for each region
// Add more regions as needed
};

return colorMap[region] || "white"; // Default to white for unknown regions
};}
Insert cell
projection2 = d3.geoMercator()
.scale(7000)
.center([7.0153,46.2533])
.translate([width / 2, 900 / 1])
Insert cell
Plot.plot({
width: 900,
height: 600,
projection: projection,
marks: [
Plot.sphere({ fill: "#ADD8E6" }),
Plot.geo(countries, { fill: "#ccc", stroke: "#fff" }),
Plot.geo(accidents, {
stroke: "#fff",
tip: true
}),
]
})
Insert cell
accidents1=accidents[0]
Insert cell
accidents2=accidents[9]
Insert cell
accidents = data.features
Insert cell
Insert cell
projection = d3.geoMercator()
.scale(35000)
.center([6.0153,49.0533])
.translate([width / 2, 900 / 1])
Insert cell
import {countries} from '@d3/world-tour'
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more