GeomBin2d

2D rectangular bin heatmap: partitions continuous x×y into a grid and maps fill to bin count by default. Empty bins are dropped unless params.drop is false.

Defaults

geom
bin_2d
default stat
bin_2d
default position
identity
params type
Bin2dParams

Svelte component

import { GGPlot, GeomBin2d } from "@ggsvelte/svelte";

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <GeomBin2d />
</GGPlot>

JSON layer

{
  "geom": "bin_2d",
  "stat": "bin_2d"
}

Params

bins

number

Number of bins on each axis. Default 30. Applies equally to x and y in v1.

binwidth

number

Shared bin width in data units for both axes (overrides bins). Prefer when the scale units are meaningful.

drop

boolean

When true (default), omit zero-count bins from the output.

alpha

number

Cell opacity. Must be between 0 and 1 (inclusive). Default 1.

linewidth

number

Outline stroke width in px when color is set. Must be greater than 0.

Allowed stats

Allowed positions

Examples

← All geoms · Getting started