Histogram2D

Category: Charts

Live preview
Height against weight
155–160
160–165
165–170
170–175
175–180
180–185
185–190
90–95
0
0
0
0
0
0
1
85–90
0
0
0
0
0
0
1
80–85
0
0
0
0
0
2
0
75–80
0
0
0
0
1
2
0
70–75
0
0
0
1
4
0
0
65–70
0
0
0
4
1
0
0
60–65
0
0
3
1
0
0
0
55–60
0
1
2
0
0
0
0
50–55
1
1
0
0
0
0
0
0
4
Row155–160160–165165–170170–175175–180180–185185–190
90–950000001
85–900000001
80–850000020
75–800000120
70–750001400
65–700004100
60–650031000
55–600120000
50–551100000
Columns bin x (Height (cm)), rows bin y (Weight (kg)), highest y at the top. 26 points in 9 rows by 7 columns; the busiest cell holds 4.

Counts of x,y points in a grid of 2-D bins (the Plotly histogram2d trace), drawn as a heatmap: d3 bin() is run once on x and once on y, the cell count is the number of points that fall in both bins, and the grid is handed to the heatmap atom, so it has the heatmap colour bar, the cell counts printed inside the cells and a hidden data table. The highest y bin is the top row. Use nbinsx and nbinsy for the number of bins (the real count is the nearest round step, as in d3), or leave them out for the Sturges default. At most 20,000 points are used and at most 40 bins per axis, each with a note.

Surfaces
webgoogle-apps-script-webmcp-appsandroid
Degraded on
SurfaceNote
pdfPrints the finished picture; no motion
Fields
FieldTypeRequired
xarray (required, numbers, at least 2 usable pairs with y; up to 20,000 used).required
yarray (required, numbers, same length as x).required
nbinsxinteger (optional, 3 to 40, the bin count asked of d3 for x; default Sturges).optional
nbinsyinteger (optional, 3 to 40, the bin count asked of d3 for y; default Sturges).optional
titlestring (optional, max 80).optional
x_labelstring (optional, max 40, named in the note under the grid).optional
y_labelstring (optional, max 40, named in the note under the grid).optional
scalestring (optional, a heatmap colour scale name such as Blues, Viridis or YlOrRd; default YlGnBu, light for few points and dark for many).optional
show_valuesboolean (optional, default true, prints each count in its cell).optional
show_colorbarboolean (optional, default true).optional
versioninteger (optional, default 1; a higher number draws as version 1 with a muted note).optional
Example payload
{
  "type": "histogram2d",
  "x": 1,
  "y": 1
}
ARD catalog entry
{
  "identifier": "urn:air:a2uicatalog.ai:atom:histogram2d",
  "displayName": "Histogram2D",
  "type": "application/vnd.a2ui.atom+json",
  "url": "https://a2uicatalog.ai/atoms/histogram2d/",
  "capabilities": [
    "web",
    "google-apps-script-web",
    "mcp-apps",
    "android"
  ],
  "description": "Counts of x,y points in a grid of 2-D bins (the Plotly histogram2d trace), drawn as a heatmap: d3 bin() is run once on x and once on y, the cell count is the number of points that fall in both bins, and the grid is handed to the heatmap atom, so it has the heatmap colour bar, the cell counts printed inside the cells and a hidden data table. The highest y bin is the top row. Use nbinsx and nbinsy for the number of bins (the real count is the nearest round step, as in d3), or leave them out for the Sturges default. At most 20,000 points are used and at most 40 bins per axis, each with a note.",
  "representativeQueries": [
    "show a histogram2d: x,y points counted into a 2-D bin grid, drawn as a heatmap",
    "counts of x,y points in a grid of 2-d bins (the plotly histogram2d trace), drawn as a heatmap: d3 bi",
    "render a histogram2d"
  ]
}
← Full ARD catalog
Deploy your own Google Apps Script renderer

The renderer is an open-source Google Apps Script web app. Deploy your own instance in 4 commands — you own the URL, no dependency on the demo endpoint.

git clone https://github.com/a2uicatalog/a2ui
cd a2ui/apps-script-surface/gas-wired-renderer
clasp push && clasp deploy
Full deploy guide →