historicalTopGraph = {
const plot = Plot.plot({
width: 250,
height: 200,
marginLeft: 20,
marginRight: 0,
marks: [
Plot.barY(
Object.entries(acceptRate)
.map(([year, rate]) => ({ year: +year, rate }))
.filter((d) => d.year >= 2020),
{ x: "year", y: "rate", fill: "#66282a", dx: -3 }
),
Plot.barY(
Object.entries(rd_acceptRate).map(([year, rate]) => ({
year: +year,
rate
})),
{ x: "year", y: "rate", dx: 3, fill: "#c33" }
),
Plot.ruleY([0])
],
x: {
paddingInner: 0.4,
paddingOuter: 0.05,
label: "Class Year"
},
y: {
grid: true,
label: "Percent of students accepted",
ticks: 20,
tickFormat: (d) => (d % 1 === 0 ? d + "%" : ""),
domain: [0, 9.5]
}
});
plot.querySelectorAll("text").forEach((el) => {
el.style.fontSize = "7";
});
plot.style.width = 800;
return plot;
}