Public
Edited
Jan 18, 2022
Insert cell
# MLB Seasons - Plot
Insert cell
md`lets see who has the most seasons`
Insert cell
Plot.plot({
width,
facet: {
data: activeTeamsData,
y:"name"
},
marks: [Plot.rectY(activeTeamsData, Plot.binX({ y: "count" }, { x: "W" }))]
})
Insert cell
activeTeamsData
Insert cell
---
# Appendix
Insert cell
data = d3.csv("https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Teams.csv", d3.autoType)
Insert cell
activeTeams = data.filter((d) => d.yearID === 2020).map((d) => d.teamID)
Insert cell
activeTeamsData = data.filter(d => d.yearID > 1968).filter((d) => activeTeams.includes(d.teamID))
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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