I have this data that I want to plot in a scatterplot. I need the FTA and FTM to be a sum of the teams that are grouped in group_teams
so that when the drop down of different seasons is chosen, the scatterplot will change with each team as a sum. Here is my notebook. Can anyone help?
You’ll probably want to keep your data tidy and then group it in Plot.
Here’s an example that also adds text labels:
marks: [
Plot.text(
season_select,
Plot.groupZ(
{ x: "sum", y: "sum" },
{
x: "FTA",
y: "FTM",
z: "TEAM_ABBREVIATION",
text: (d) => d[0].TEAM_ABBREVIATION,
textAnchor: "start",
dx: 5
}
)
),
Plot.dot(
season_select,
Plot.groupZ(
{ x: "sum", y: "sum" },
{ x: "FTA", y: "FTM", fill: "TEAM_ABBREVIATION", tip: true }
)
)
]
Ok thank you for the solution!