Scatterplot Layer
A circle per row.
Syntax
{ "id": "n1", "op": "scatter", "name": "scatter", "x": 0, "y": 0, "params": {} }
An edge into it ends at "targetPort": "in"; one out of it starts at "sourcePort": "out"; a parameter is set in params (leave out the ones at their default), driven by an edge to par:radiusScale, or read elsewhere as ch('scatter/radiusScale').
Inputs
| Port | Type | Takes |
|---|---|---|
in | table | one edge |
Parameters
| Parameter | Kind | Default | Choices |
|---|---|---|---|
position | expr | "P" | |
color | expr | "" | |
radius | expr | "" | |
lineColorChannel | expr | "" | |
lineWidth | expr | "" | |
ramp | menu | "viridis" | 37 choices |
radiusScale | float | 4 | |
radiusUnits | menu | "pixels" | pixels, meters |
fillColor | color | [255,140,0] | |
stroked | toggle | false | |
lineColor | color | [255,255,255] | |
lineWidthScale | float | 1 | |
lineWidthUnits | menu | "pixels" | pixels, meters |
billboard | toggle | false | |
antialiasing | toggle | true | |
opacity | float | 1 | |
blend | menu | "normal" | normal, additive, subtractive |
depthTest | toggle | true | |
depthWrite | toggle | true | |
extensions | field | [] |
Outputs
| Port | Type |
|---|---|
out | layer |
Remarks
Scatterplot Layer draws one circle per row of its input. Position, Color and Radius are per-row expressions over the rows' columns, or the name of a column an Attribute Create made. Position defaults to P, so until a column named P exists or Position names another, the layer has nothing to place.
A few defaults differ from deck.gl's own ScatterplotLayer, which matters when you follow the deck.gl docs:
| Parameter | Here | deck.gl |
|---|---|---|
radiusUnits | "pixels" | "meters" |
radiusScale | 4 | 1 |
Circles therefore keep their size on screen as you zoom. To size them on the ground, set Radius units to meters.
An empty Color draws every circle in Fill color. A Color expression gives [r, g, b] from 0 to 1, or uses ramp(t) for a value from 0 to 1 on the layer's Color ramp. Radius scale, Fill color and Opacity are deck props: dragging them redraws without reading any rows again.
Examples
Circles at each row's longitude and latitude, sized on the ground:
{ "id": "n1", "op": "scatter", "name": "points", "x": 0, "y": 0, "params": { "position": "[lng, lat]", "radius": "sqrt(mag) * 500", "radiusScale": 1, "radiusUnits": "meters" } }
Details
- Category: Layers
- Operator:
scatter
Older projects
Projects saved before documents used operator classes. These convert to scatter when they open: GeoJsonLayerOp, ScatterplotLayerOp.