Skip to content

Commit 3ab2e19

Browse files
Filmbostock
andauthored
document hexgrid (#1389)
* document hexgrid * more details * edits --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent cc8ce36 commit 3ab2e19

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ Returns a new *fy* grid with the given *options*.
15031503
15041504
### Hexgrid
15051505
1506-
The hexgrid mark can be used to support marks using the [hexbin](#hexbin) layout.
1506+
The hexgrid mark can be used to support marks using the [hexbin](#hexbin) transform.
15071507
15081508
#### Plot.hexgrid(*options*)
15091509

src/marks/hexgrid.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
import type {MarkOptions, RenderableMark} from "../mark.js";
22

3+
/** Options for the hexgrid mark. */
34
export interface HexgridOptions extends MarkOptions {
5+
/**
6+
* The distance between centers of neighboring hexagons, in pixels; defaults
7+
* to 20. Should match the **binWidth** of the hexbin transform.
8+
*/
49
binWidth?: number;
510
}
611

12+
/**
13+
* The hexgrid decoration mark complements the hexbin transform, showing the
14+
* outlines of all hexagons spanning the frame with a default **stroke** of
15+
* *currentColor* and a default **strokeOpacity** of 0.1, similar to the the
16+
* default axis grids. For example:
17+
*
18+
* ```js
19+
* Plot.plot({
20+
* marks: [
21+
* Plot.hexagon(Plot.hexbin({fill: "count"}, {binWidth: 12, x: "weight", y: "economy"})),
22+
* Plot.hexgrid({binWidth: 12})
23+
* ]
24+
* })
25+
* ```
26+
*
27+
* Note that the **binWidth** option of the hexgrid mark should match that of
28+
* the hexbin transform. The grid is clipped by the frame. This is a stroke-only
29+
* mark, and **fill** is not supported; to fill the frame, use the frame mark.
30+
*/
731
export function hexgrid(options?: HexgridOptions): Hexgrid;
832

33+
/** The hexgrid mark. */
934
export class Hexgrid extends RenderableMark {}

0 commit comments

Comments
 (0)