Public
Edited
Oct 15, 2022
1 star
Insert cell
# Nationalities of Premier League players
Insert cell
Insert cell
Insert cell
world = FileAttachment("world.json").json()
Insert cell
Insert cell
Insert cell
pl_country_freq_geom = FileAttachment("pl_country_freq_geom.json").json()
Insert cell
Insert cell
Insert cell
bertin = require("bertin@1.2.4")
Insert cell
viewof k = Inputs.range([5, 25], { label: "radius max", step: 1, value: 15 })
Insert cell
viewof metric_bubble_size = Inputs.radio(["n_players", "n_matches_played"], {label: "Choose which metric to use for sizing the bubbles", value: "n_players"})
Insert cell

bertin.draw({
params: { projection: "Bertin1953"},
layers: [
{
type: "bubble",
geojson: pl_country_freq_geom,
values: metric_bubble_size,
k: k,
dorling: false,
fill: "#D98324",
tooltip: {
fields:
["$country", "$n_players", "players", "$n_matches_played", "matches played"],
fontStyle: ["bold", "normal", "italic", "normal", "italic"],
fill: "#fefefe",
fillOpacity: 0.6
},
leg_round: 0,
leg_x: 700,
leg_y: 400,
leg_round: -1,
leg_title: "Number of\nPremier League players\nfrom country"
},
{
type: "layer",
geojson: world,
fill: "white",
fillOpacity: 0.3
},
{
type: "layer",
geojson: pl_country_freq_geom,
fill: "#230007",
fillOpacity: 0.2
},
{ type: "graticule" },
{ type: "outline" }
]
})
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