Plot.plot({
style: {
fontSize: "12pt",
background: "white"
},
x: { line: true },
marks: [
Plot.dotX(
sm,
Plot.dodgeY({
x: "year",
title: "num_votes",
fill: (d) => {
if (d.main_gener === "Drama") return "#fe218b";
if (d.main_gener === "Comedy") return "#fed700";
return "#495057";
},
fillOpacity: 0.7,
anchor: "bottom",
r: (d) => Math.sqrt(d.num_votes) * 0.1,
title: (d) =>
`${d.primary_title}\nVotes: ${d.num_votes.toLocaleString()}\n ${
d.main_gener
} \n ${d.year}`
})
),
Plot.axisX({
fill: "black",
tickFormat: d3.format("d"),
tickPadding: 2,
label: null
}),
Plot.text(["The 'Summer' Surge in Film Titles"], {
frameAnchor: "middle",
dx: -170,
dy: -320,
fontSize: 55,
fill: "black",
fontFamily: "Kalnia Glaze"
}),
Plot.text(
[
"A Century of Films Featuring 'Summer' in Their Title: Dramas and Comedies \n\n Sized by IMDb Votes, Titles with fewer than 10 votes were not included."
],
{
frameAnchor: "middle",
dx: -180,
dy: -250,
fontSize: 20,
fill: "black",
fontFamily: "Kalnia Glaze"
}
)
],
height: 1020,
width: 1200,
marginBottom: 60,
marginTop: 60,
marginLeft: 120,
marginRight: 50,
grid: true,
color: { legend: true }
})