medalsIso = (data) => (Plot.plot({
title: "How many times a national song was played in the Olympics",
subtitle: "Top 10 Gold Medal Winners in the 2016 Olympic Games",
height: 900,
width,
marginLeft: 35,
y: {
label: null,
domain: d3.sort(data, d => -d.Gold).map(d => d.nation),
tickFormat: (d) => ( nations[d.nation] ? nations[d.nation] : d)
},
x: {
domain: [0.5, 1],
axis: null
},
marks: [
Plot.text(data, {
text: (d) => `${medals.gold}`.repeat(d.Gold),
y: "nation",
frameAnchor: "left",
fontSize: 20,
lineWidth: 70,
}),
Plot.text(data,
Plot.stackX({
text: (d) => `${medals.silver}`.repeat(d.Silver),
y: "nation",
frameAnchor: "left",
fontSize: 20,
dx: 0,
dy: 20
})),
Plot.text(data,
Plot.stackX({
text: (d) => `${medals.bronze}`.repeat(d.Bronze),
y: "nation",
frameAnchor: "left",
fontSize: 20,
dx: 0,
dy: 40
}))
]
}))