Skip to main content

teamColor

02468101214↑ winsBUFKCLACteam
import * as Plot from "@observablehq/plot";
import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamColor } from "@sportsdataverse/sdvplot/plot";

await loadLeague("nfl");
const wins = [
{ team: "KC", wins: 15 },
{ team: "BUF", wins: 13 },
{ team: "LAC", wins: 11 },
];
Plot.plot({
color: teamColor("nfl", { values: wins.map((w) => w.team) }),
marks: [Plot.barY(wins, { x: "team", y: "wins", fill: "team" })],
});

Tags: docstring · teamColor. All sdvplot examples.