Plot.plot({
width: width,
height: 500,
marginLeft: 50,
marginRight: 100,
color: "white",
marks: [
Plot.ruleY([0]),
Plot.barY(getAverageRidership(line), Plot.groupX({ y: "mean" }, { x: "date", y: "ridership", fill: "steelblue", fillOpacity: 1 })),
Plot.lineY(
tidyData,
{ x: "date", y: "ridership", z: "station", curve: "monotone-x", stroke: "orange", strokeOpacity: 0.2, strokeWidth: 1 }
),
Plot.lineY(
filteredStations,
{ x: "date", y: "ridership", z: "station", tip: "x", curve: "monotone-x", stroke: "orange", strokeOpacity: 1 }
),
Plot.dot(
filteredStations,
{ x: "date", y: "ridership", r: 3, stroke: "orange", fill: "white", strokeOpacity: 1 }
),
Plot.text(
filteredStations,
Plot.selectLast({ x: "date", y: "ridership", z: "station", text: "station", textAnchor: "start", dx: 18, fontWeight: 500 })
),
]
})