Public
Edited
Feb 24, 2023
Fork of insee
Insert cell
Insert cell
xls=FileAttachment("grille_densite_7_niveaux_detaille_2022@1.xlsx").xlsx()
Insert cell
data = xls.sheet(0)
Insert cell
data
select substring(A,1,2) as Dep, sum(E) as Pop, D as Typo from data where Dep in ('08','10','51','52','54','55','57','88','67','68') group by Dep,Typo order by Pop ;
Insert cell
addTooltips(Plot.plot({
width : 1000,
height: 350,
marginLeft: 200,
color: {range: ["#fef500", "#ffb900", "#fffcaa", "#ff0000", "#a2fc89", "#2f8417"], type: "categorical", legend: true},
marks: [
Plot.barX(Query, {x: "Pop", y: "Dep", title: "Pop", sort: {y: "x", reverse: true}, fill:"Typo"}),
Plot.ruleX([0])
]
}))
Insert cell
addTooltips(Plot.plot({
width : 1000,
height: 500,
x: {axis: null, domain: Query.Typo},
y: {tickFormat: "s"},
//color: {scheme: "spectral", domain: Query.Typo},
color: {range: ["#fef500", "#ffb900", "#fffcaa", "#ff0000", "#a2fc89", "#2f8417"], type: "categorical", legend: true},
facet: {data: Query, x: "Dep"},
marks: [
Plot.barY(Query, {
x: "Typo",
y: "Pop",
title: "Typo",
fill: "Typo",
sort: {fx: "x", reduce: "sum", reverse: true}
}),
Plot.ruleY([0])
]
}))
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
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