Skip to main content

Function: sizeCells()

sizeCells(cells, o): CellSizes

Defined in: packages/sdvplot/src/shots/aggregate.ts:266

Frequency size for each cell (the dual encoding's size half; colour is diffScale), on the lattice's full cell size R (a hexagon's radius, or a square's side; pass the index itself: sizeCells(cells, index)). "sqrt-p95" (default, main hexShotChart.ts:65-81): a sqrt scale of attempts to R, capped at the 95th percentile so one busy rim cell does not shrink the rest; area follows attempts for either shape. "linear-cap" (master Hexagon/index.js:22-30): attempts in tenths, capped at R, cells under 2 attempts hidden.

Parameters​

cells​

readonly object[]

o​

BinnerOptions & object

Returns​

CellSizes

Example​

import { binShots, sizeCells } from "@sportsdataverse/sdvplot/shots";

// Brooklyn shots from the sportsdataverse-data nba_stats_shots release, 2025-26
const shots = [
{ x_legacy: -1, y_legacy: 7, shot_distance: 1, shot_value: 2, shot_result: "Made" },
{ x_legacy: 0, y_legacy: 0, shot_distance: 0, shot_value: 2, shot_result: "Missed" },
{ x_legacy: -44, y_legacy: 252, shot_distance: 26, shot_value: 3, shot_result: "Made" },
];
sizeCells(binShots(shots, 15), { radius: 15 }).r; // the 2-attempt rim cell is full size, the 1-attempt three smaller