Public
Edited
Apr 2, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maplibregl = require("maplibre-gl@2.1.9")
Insert cell
Insert cell
lightpoles_ss_nyc1 = FileAttachment("lightpoles_ss_nyc (1).json").json()
Insert cell
shotspot_nyc1 = FileAttachment("shotspot_nyc-1.geojson").json()
Insert cell
shotspotter_pluto = FileAttachment("shotspotter_pluto.json").json()
Insert cell
viewof table = Inputs.table(shotspotter_pluto.features.map((s) => s.properties))
Insert cell
ssp = shotspotter_pluto.features
Insert cell
ownertypes = Object.entries(
Object.groupBy(ssp, ({ properties }) => properties.OwnerType)
)
.map((m) => {
return { OwnerType: m[0], Total: m[1].length };
})
.map((m) => {
if (m.OwnerType == "") {
m.OwnerType = "Blank";
return m;
} else {
return m;
}
})
.map((m, i) => {
m.OwnerType = labels[i];
return m;
})
Insert cell
labels = [
"Other",
"Blank",
"Tax-Exempt (City, State, or Other)",
"Private",
"City",
"Mixed Public/Private"
]
Insert cell
ownertypesPlot = Plot.plot({
y: {
grid: true
},
marks: [
Plot.ruleY([0]),
Plot.barY(ownertypes, {
fill: "teal",
x: "OwnerType",
y: "Total"
})
]
})
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