Skip to main content

squarebin

[
  [
    0,
    0,
    1
  ],
  [
    0,
    10,
    1
  ],
  [
    10,
    90,
    1
  ]
]
import { squarebin } from "@sportsdataverse/sdvplot/bins";

const shots = [
{ x_legacy: 0, y_legacy: 0 },
{ x_legacy: -1, y_legacy: 7 },
{ x_legacy: 5, y_legacy: 91 },
];
squarebin(shots, { side: 10, x: (s) => s.x_legacy, y: (s) => s.y_legacy }).map((b) => [b.x, b.y, b.length]);

Tags: docstring · squarebin. All sdvplot examples.