embed({
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
width: 700,
height: 400,
hconcat: [
{
layer: [
{
data: { url: "https://mjlobo.github.io/teaching/mde/data/chicagosideswithid.json", format: { type: "topojson", feature: "chicago_sides" } },
mark: { type: "geoshape", fill: "#f0f0f0", stroke: "white" },
projection: { type: "mercator" }
},
{
data: { values: accidents_de_voiture_chicago.objects() },
transform: [ { filter: "datum.hit_and_run === 'Y'" } ],
mark: { type: "circle", color: "red", size: 6 },
encoding: {
longitude: { field: "LONGITUDE" },
latitude: { field: "LATITUDE" }
}
}
],
title: "Délits de fuite (Y)"
},
{
layer: [
{
data: { url: "https://mjlobo.github.io/teaching/mde/data/chicagosideswithid.json", format: { type: "topojson", feature: "chicago_sides" } },
mark: { type: "geoshape", fill: "#f0f0f0", stroke: "white" },
projection: { type: "mercator" }
},
{
data: { values: accidents_de_voiture_chicago.objects() },
transform: [ { filter: "datum.hit_and_run === 'N'" } ],
mark: { type: "circle", color: "blue", size: 6 },
encoding: {
longitude: { field: "LONGITUDE" },
latitude: { field: "LATITUDE" }
}
}
],
title: "Pas de délit de fuite (N)"
},
{
layer: [
{
data: { url: "https://mjlobo.github.io/teaching/mde/data/chicagosideswithid.json", format: { type: "topojson", feature: "chicago_sides" } },
mark: { type: "geoshape", fill: "#f0f0f0", stroke: "white" },
projection: { type: "mercator" }
},
{
data: { values: accidents_de_voiture_chicago.objects() },
transform: [ { filter: "!datum.hit_and_run || (datum.hit_and_run !== 'Y' && datum.hit_and_run !== 'N')" } ],
mark: { type: "circle", color: "gray", size: 6 },
encoding: {
longitude: { field: "LONGITUDE" },
latitude: { field: "LATITUDE" }
}
}
],
title: "Données manquantes (NaN)"
}
]
})